Profiles

JHipster comes with three Spring "profiles":

  • "dev" for development: it focuses on ease of development and productivity
  • "prod" for production: it focuses on performance and scalability
  • "fast" for advanced users in development: it focuses on fast start-up time, at the cost of disabling some services

Those profiles come in two different configurations:

  • The Maven profiles are used at build time. For example mvn -Pprod package will package a production application.
  • The Spring profiles work at run time. Some Spring beans will behave differently, depending on the profile.

Spring profiles are set by Maven, so we have a consistency between the two methods:you will have a "prod" profile on Maven and Spring at the same time.

In default mode, JHipster will use the "dev" profile

If you run the application without Maven, launch the "Application" class (you can probably run it easily from your IDE by right-clicking on it).

If you run the application with Maven, run mvn

In production, JHipster has to run with the "prod" profile

Use Maven to build the application with the "prod" profile: mvn -Pprod

When you run the application, don't forget to add the "prod" profile, by adding --spring.profiles.active=prod to your program arguments.

You can test it with Maven, by running mvn -Pprod

For advanced users, you can use the "fast" profile

The fast profile works with the "dev" profile, but makes some changes so that application starts up faster. On a recent MacBook Pro, you can expect to start-up:

  • In 6 seconds with the "SQL" option
  • In 4 seconds with the "NoSQL" (MongoDB) option

To start faster, this profile :

  • Uses Undertow instead of Tomcat
  • Disables Liquibase (so you should use this profile with an external database, and not H2, or your database will be empty)
  • Disables Swagger (if you have lots of REST endpoints, Swagger will become very slow)
  • Disables the Async service
  • Disables the Cache service
  • Disables the Metrics service

When you run the application, use the "fast" profile with the "dev" profile, by adding --spring.profiles.active=dev,fast to your program arguments.

If you use Maven, run mvn -Pfast (the Maven "fast" profile will automatically select the "dev" and "fast" Spring profiles).