
It is really hard to look at any other alternative to TypeScript for Angular2 development. Not only is it easy to learn it is also far less error prone compared to developing in JS as you get static type checking for classes, interfaces and so on.
Sometimes you just want to write Angular2 app in java8 and hopefull java9 soon. This is particularly a non-brainer if it’s only a small application where in splitting the app into multiple component/tiers (WebClient, Service & Backend REST-API) is not really worth the overhead.
I just want to write my Angular2 app in Java8
Enters Angular2Boot
- Write angular2 app in java8
- Framework built on top of Angular 2, GWT and Spring Boot
- Gwt used to compile to JS
- You are free to mix GWT and Angular, but why if not to deal with legacy only.
Benefits
- TypeScript is good but here you get an even stronger typed OO language in Java
- Numerous tried and tested tooling and IDEs aroung for java.
- And for when you need one single jar, nothing better than one uber springboot jar! Not to mention the simplicity and ease of Springboot, especially when building POCs
- And lets face it, java is the language of choice for building robust applications
Give it a try (5minute)
Create Project
Generate Angular and Gwt App from archetype template
mvn archetype:generate \ -DarchetypeGroupId=fr.lteconsulting \ -DarchetypeArtifactId=angular2-gwt.archetype \ -DarchetypeVersion=1.6
- This will then do the scanning and downloading of dependences etc. You’ll then be prompted to feed in a few more details:
# Define value for property 'groupId': com.mosesmansaray.play # Define value for property 'artifactId': angular-gwt-in-java8-example # Define value for property 'version' 1.0-SNAPSHOT: : # Define value for property 'package' com.mosesmansaray.play: :
- Then confirm properties configuration to complete
Install
To install/produces and executable fat jar
mvn clean install
- The above will complete the download of further dependences needed to compile the application.
- It should then be ready in your application target folder e.g.
/angular-gwt-in-java8-example/target/angular-gwt-in-java8-example-1.0-SNAPSHOT.jar
Run
To run the fat jar
java -jar target/angular-gwt-in-java8-example-1.0-SNAPSHOT.jar
Development
Developing/Live reload
- Backend
mvn spring-boot:run
- Frontend
mvn gwt:run-codeserver
Resources
- Documentation and More From Here at lteconsulting.fr
- Libary SourceCode
- Or checkout Arnaud Tournier’s talk at GWT con 2016 bellow:
- Angular2boot Tour of Heroes Tutorial
- Demos on github
- The angular2-gwt.archetype
Leave a Reply