简体   繁体   中英

Spring + Hibernate + Spring Security + REST API with Angular2 Front End Without NodeJS

I am now developing a Spring + Hibernate + Spring Security + REST API based Web Application for my Final Year Project.

When I started Dynamic front End then I noticed Angular2 is changed their Technology significantly. Angular2 is much easier than Angular1 and also it's too much faster than Angular1. So I did not much interested to learn much about AngularJS1.

Now I am trying to Learn Angular2. I notice there is much JavaScript and TypeScript technology for deploying an Angular2 project. Like gulpjs, nodejs, Systemjs, babelJS etc. But it is too much for me to learn so much Front End technology at this time. I don't want to learn NodeJS now.

  1. I need to know is there any way to Deploy Angular2 Application by Maven or gradle build tool and Tomcat Server?

  2. I already know some jQuery and Angular1. So, should I go for those now?

Angular2 is developed in TypeScript and most resources you'll find will be in TypeScript. So, generally speaking, it would be better if you could develop using TypeScript.

That being said, you can also write Angular2 code in ECMAScript5 (aka regular JavaScript).

If you develop in ES5, does not matter what your backend is. All you have to do is include the necessary <script> tags in the HTML page sent to the user and you're good to use Angular2. The backend usually provides REST services which can be created in many languages/environments, including Java/Spring.

As you can notice, in the setup above, you don't need Node at all. You can even run Jasmine tests using Maven or similar tools.

If you choose to write your code in TypeScript, though, you'll have to at least take care of the transpilation step. If could happen in the browser (like angular.io's plunker does), but there is a performance penalty, big enough to render this approach impractical for large enough projects.

On the other hand, I don't know any (haven't searched, though), but there probably are TypeScript plugins for Maven.

To sum up, you can develop Angular2 without Node, but you'll have to take care yourself of some tasks that Node's tools would give you. Tasks such as testing, minification, uglification, and such. Using Node, all of that is handed to you (with Karma and WebPack, for instance) and there are plenty of tutorials around. Without Node, you're on your own to glue them all together. It is definitely doable, but it does have its caveats.

you can run it on any HTTP server. Just build your angular2 project and put the javascript files (from dist folder created in your app after build) on the web deployment folder of you server. You can create maven/gradle project then you put these files into the project web content directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM