Profiles

JHipster comes with two Spring "profiles":

  • dev for development: it focuses on ease of development and productivity
  • prod for production: it focuses on performance and scalability

Those profiles come in two different configurations:

  • The Maven/Gradle profiles are used at build time. For example mvn -Pprod package or gradlew bootRepackage -Pprod 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/Gradle, so we have a consistency between the two methods:you will have a "prod" profile on Maven/Gradle and Spring at the same time.

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

If you run the application without Maven/Gradle, 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

If you run the application with Gradle, run gradlew

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

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

Use Gradle to build the application with the "prod" profile: gradlew -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

You can test it with Gradle, by running gradlew -Pprod

Profile switches

JHipster comes with two Spring "profiles" used as switches:

  • no-swagger to disable swagger
  • no-liquibase to disable liquibase

These can be used along with both dev and prod profiles

The are used at run time. For example java -jar myApp.war --spring.profiles.active=prod,no-liquibase or ./gradlew -Pprod -Pno-liquibase or ./gradlew -Pno-liquibase -Pno-swagger