JHipster release 4.0.0

This new major release is a huge step forward, after nearly one year of very hard work.

This would never have been possible without our wonderful core dev team and our incredible number of contributors! Thank you so much, everyone!

Summary

JHipster now support both AngularJS 1 and Angular 2.x, making it:

  • The only available “full stack” generator for Angular 2.x
  • The only generator that creates non-trivial Angular 2.x code, in particular using our JDL Studio

We have also removed a lot of our previous pain points, so that generation is easier, faster, and safer.

Angular 2 support

This is the main big news, we now support Angular 2.x! To be more precise:

  • AngularJS 1 is still our default option: you can use it perfectly fine with JHipster. This is our battle-tested, widely-use code, so if you want something very stable, that’s your best option.
  • Angular 2 is now marked “beta”, even if we already know lots of projects are using it successfully. We have very little known bugs and very few limitations, so you can start using it on your project. 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.

Migration to Yarn

While we still support NPM, our migration to Yarn has been very successful: builds are much faster, and we have much less download issues. So we recommend everyone switches to Yarn, and we might drop official NPM at some point in the future.

If you use Angular 2 (our previous point), we have also replaced Bower by Yarn. That means we only have one package manager, which is much more performant and gives much better quality.

Migration to Webpack

With Angular 2, we migrated from Gulp to Webpack.

Webpack is much more efficient for working with Angular 2, and it can also be run directly from Yarn. No need to install Gulp anymore!

Yes, if you use Angular 2 + Yarn + Webpack, we removed all the installation pain points of JHipster 3.x !!!

JHipster server-side library and NG JHipster library

One of the usual complaints with JHipster is that we generated too much code. So with JHipster 4 we introduce 2 new libraries:

  • 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.

As a result, the generated code should be much simpler, and easier to understand.

Constructor-based injection

JHipster is a complete upgrade of Spring libraries, with some major refactoring. The most important one is our switch from field-based injection to constructor-based injection.

  • Constructor-based injection is considered cleaner by many people, in particular as it eases testing
  • JHipster now has constructor-based injection both in Spring and in Angular, making the code more homogeneous
  • This removes the need for the @Inject annotations, so we have deleted the javax.inject dependency from the project

“AAA” ranking on Sonar

As a result of a lot of refactoring (including the previous point on constructor-based injection), we are happy to announce that our sample generated project has the highest “AAA” mark on Sonar.

The official Sonar report can be viewed here, and is automatically generated after each commit on our master branch.

This means that a JHipster-generated project is of much higher quality than most “hand-crafted” projects!

What’s next?

As this is a 4.0.0 release, with a lot of changes, we expect to release regularly patch versions. Be sure to follow @jhipster to be notified of those new versions!

Our documentation is not totally updated, as it is very big. If you see any issue, don’t hesitate to create a ticket, and maybe even send a pull request, on our documentation repository.

关闭的工单与合并请求

一如既往, 你可以在此处查看所有已关闭的工单与已接受合并请求.

更新指引

As this is a major upgrade, expect quite a lot of merges if you use our JHipster upgrade sub-generator on an existing application.

Of course, it will work a lot better if you stay on AngularJS 1! Otherwise you will need to migrate your whole front-end manually.

To use our JHipster upgrade sub-generator, run:

yo jhipster:upgrade

选择手动升级, 需要先升级你的Jhipster版本:

npm update -g generator-jhipster

如果你已经有了一个项目, 将会继续使用当时项目生成的Jhipster版本. 如果需要升级你的项目, 你需要先删除node_modules文件夹再运行:

yo jhipster

更新你的项目和所有的实体类

yo jhipster --with-entities

你也可以使用实体类子生成器挨个更新你的实体类, 例如你的实体类名字是_Foo_

yo jhipster:entity Foo

帮助和缺陷

如果您发现这个版本的任何问题, 请随时联系我们:

如果您遇到的问题是紧急错误或安全问题,请: