days
1
5
hours
0
6
minutes
0
1
seconds
2
8
search
And migration to Yarn

JHipster 4.0 brings Angular 2 support

JAX Editorial Team

After nearly one year of hard work, JHipster is ready for a new major release. 4.0 supports both AngularJS 1 and Angular 2.x and has successfully migrated to Yarn. But that’s not all — let’s see what else is new.

JHipster is now the only available “full stack” generator for Angular 2.x and the only generator that creates non-trivial Angular 2.x code, in particular using their JDL Studio. Generation is now easier, faster, and safer as pain points have been removed from JHipster 4.0.

Angular 2 support

One day after JHipster 4.0 was released, the team announced that they broke their record number of installations. The “culprit” could be the main big news, namely the Angular 2 support. Although AngularJS remains the default option, it can be used “perfectly fine” with JHipster. “This is our battle-tested, widely-use code, so if you want something very stable, that’s your best option,” the team said in the release notes.

Furthermore, Angular 2 is now marked “beta.” The team advises users to start using it in their projects since they have “very little known bugs and very few limitations. The main issue is that this code is very new, so we expect to release a lot of patch releases in the next weeks, so you must be ready to update your project a few times,” they added.

Migration to Yarn & Webpack

Although JHipster still supports NPM, the migration to Yarn has been successful. As a result, official NPM might be dropped at some point in the future. Those who use Angular 2 should know that Bower has been replaced with Yarn so there’s only one package manager, which is much more performant and gives much better quality.

With Angular 2, they migrated from Gulp to Webpack since the latter is much more efficient for working with Angular 2, and it can also be run directly from Yarn. So there is no need to install Gulp anymore.

JHipster server-side library and NG JHipster library

JHipster 4.0 comes bearing gifts: two new libraries which should make the generated code much simpler and easier to understand:

  • The JHipster server-side library contains “utility” classes that were previously generated. You can still extend or override them if you don’t like their default implementation, in those (unlikely) use cases where those classes don’t suit you.
  • The NG JHipster library contains the same kind of “utility” code that was previously generated but for Angular 2.x.

Constructor-based injection

JHipster is a complete upgrade of Spring libraries, with some major refactoring. The most important one is the switch from field-based injection to constructor-based injection since many people consider the latter cleaner, especially as it eases testing. The code is more homogenous now that it has constructor-based injection both in Spring and in Angular.

Furthemore, this removes the need for the @Inject annotations, so the javax.inject dependency has been deleted from the project.

“AAA” ranking on Sonar

JHipster’s sample generated project has the highest “AAA” mark on Sonar. The report can be viewed here, and is automatically generated after each commit on their master branch.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of