BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News JHipster 2.0 Released with AngularJS improvements, Liquibase diffs, and Spring WebSockets

JHipster 2.0 Released with AngularJS improvements, Liquibase diffs, and Spring WebSockets

Lire ce contenu en français

Bookmarks

JHipster, the Yeoman generator for Spring Boot/Angular projects, released version 2.0 earlier this month, with some notable changes:

  • The AngularJS code has been modularized, making it easier to use JHipster for larger projects.

  • Liquibase is now able to create "diffs" between the JPA code and the database, making it easier to update your database schema.

JHipster is an open source project that simplifies the creation of projects based on an AngularJS client and a Spring Boot powered API. Started by French Java expert and author Julien Dubois, JHipster leverages Yeoman to create the project, as well as to generate its code.

JHipster prompts you with a number of choices when you first create a project. Its technology stack is broad, with a few foundational frameworks, and a number of options.

Foundational Frameworks and Tools

  • Spring Boot
  • Spring Security
  • AngularJS
  • Bootstrap
  • Bower
  • Metrics

Project Options

  • Java 7 or Java 8
  • Maven or Gradle
  • Authentication Type: cookie-based or OAuth2
  • Type of Database: SQL or NoSQL
  • Caching: EhCache or Hazelcast
  • WebSocket Support
  • Grunt or Gulp.js

What's new in JHipster v2.0 provides even more details:

  • ui-router is the new router for AngularJS.
  • English and French are installed by default for i18n. However, there is support for an additional 11 languages, which you can easily install.
  • All commands from the Yoeman generator for AngularJS will now work with JHipster.
  • Migrated from Atmosphere to Spring Websockets.
  • Added a Spark reporter for Metrics.
  • Statistics on projects are now gathered using Insight.

InfoQ spoke to Dubois about the release and JHipster in general.

InfoQ: What inspired you to create JHipster?

I was working for a big e-commerce website where people were using Grunt and Ant together, which I found was a very neat idea. At that time, I wanted to have fun with the latest technologies, like AngularJS and Yeoman, and plug them on top of Spring, which was my favorite back-end stack. There was no other idea than having fun with the technologies I liked, and see how they could all fit together.

InfoQ: What has your experience with using Yeoman for code generation?

Excellent. It's very easy to use and understand, and I'm surprised by how fast I can develop with it. Because it's so easy to learn, it has allowed us to have a great number of contributors, which have helped us tremendously to improve the project.

InfoQ: What has been the most difficult component to maintain in JHipster?

Some components are of course more complex than others, but overall our biggest issue is that we have a huge combination of components. An application using Maven + Java 7 + stateful authentication + PostgreSQL is very different from an application using Gradle + Java 8 + OAuth 2.0 + MongoDB + WebSockets... I'm happy to say our code base is quite clean, and that it's not as impossible to maintain as it may seem, but when I want to test everything it takes a lot of time.

InfoQ: The 2.0 release gathers statistics (if the user agrees) about a user's choices. What trends are you seeing when people create new applications with JHipster?

I must add that those statistics are, of course, fully anonymized.

It's very important for us to gather those statistics, as we need to know what's useful and popular, so we can focus on the right components, and deprecate the others.

As those statistics are only available from our latest v2.0 version, I only have 1 week of data, from the people who are living on the bleeding edge, and who agreed to send them. But here are my most interesting results, from more than 1,200 generated projects:

  • We have users all over the world, the top 5 countries being the US, France, Sweden, China and the UK.
  • 72% of users are using Java 8, and 28% are using Java 7, it will be interesting to see how this evolves in the future.
  • 58% of users are using the H2 in-memory database for development, which I find a very high number as they don't benefit from our "liquibase:diff" Maven goal.
  • Only 8% of users are using MongoDB.
  • The most popular cloud is Heroku, then CloudFoundry, and nobody uses OpenShift.
  • 75% of people use the standard, stateful Spring Security authentication.
  • Less than 2% of users are working with Compass, which is therefore a good candidate for deprecation.

InfoQ: What are your feelings about Angular 2.0 not being backward compatible?

The feeling that the AngularJS team did a very poor job when they announced it. Then I understand they need to go forward, and that means breaking things. I don't think we currently build software to last for 10 years, so this doesn't bother me too much.

InfoQ: When will JHipster migrate to and support Angular 2.0?

Supporting AngularJS 2.0 should be very easy, it's like we currently support Java 7 and Java 8. Basically, it's just some switches in our front-end code, so I'm really not worried at all.

I'm waiting until they have something stable enough, probably when they will start to have beta releases.

InfoQ: Can you use Scala or Groovy (instead of Java) in a JHipster project?

No, we don't generate Scala or Groovy code. Of course, Groovy would fit quite nicely as we are based on Spring Boot, but I haven't tried it myself.

InfoQ: JHipster's documentation says you support Cloud Foundry, Heroku and Open Shift. Which of these cloud providers has been the easiest to work with?

CloudFoundry, without hesitation. First of all, its health manager and its agents are very good at monitoring and running your applications, I have found them much more advanced than their counterparts. Its configuration, with a simple YAML file, is also very simple: have a look at the code of my generators, the difference is striking. And last but not least, the Spring Cloud support is great: it auto-configures the database, gives you a specific Spring profile... When you know how it works it's in fact very simple, but it's nicely done, removes a lot of work, and feels more polished.

InfoQ: What's your favorite JHipster feature?

I love the entity sub-generator, which allows to generate a full CRUD user interface from the database up to the AngularJS code. It is very powerful, and depending on your options it will generate for you all the boilerplate code, and give you an easy-to-update and modular code.

This is probably our killer feature, as when you use it correctly, you can generate most of your database-driven code in a few minutes.

InfoQ: Any advice for future users of JHipster?

The best place to start is our website, http://jhipster.github.io/ , where you can find lots of documentation. As soon as you have generated your first project, you can play around with the code, and of course learn more about Spring Boot and AngularJS, which are our main frameworks.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT