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 ./mvnw -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.

Note: Spring profiles are used to configure the JHipster application properties, so you should be interested in reading our Common application properties documentation.

By default, 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 ./mvnw to use our Maven Wrapper, or mvn to use your own Maven installation.

If you run the application with Gradle, run ./gradlew to use our Gradle Wrapper, or gradle to use your own Gradle installation.

In production, JHipster has to run with the prod profile

You can run JHipster in production directly using Maven or Gradle:

  • With Maven, run ./mvnw -Pprod (or mvn -Pprod)
  • With Gradle, run ./gradlew -Pprod (or gradle -Pprod)

If you want to package your application as an executable WAR file, you should provide Maven or Gradle with a profile. E.g.,:

  • With Maven, run ./mvnw -Pprod package (or mvn -Pprod package)
  • With Gradle, run ./gradlew -Pprod bootRepackage (or gradle -Pprod bootRepackage)

When you run your production application from a WAR file, the default is to use the same profile(s) as used during packaging. If you want to override this, you can explicitly provide an alternative in VM argument:

  • ./java -jar jhipster-0.0.1-SNAPSHOT.war

Spring profiles switches

JHipster comes with three additional profiles used as switches:

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

These can be used along with both the dev and prod profiles. Please note that by default, the swagger profile is disabled in prod and enabled in dev by setting the spring.profiles.include property in application.yml.

swagger and no-liquibase are only used at runtime:

  • In your IDE, run your main application class with,no-liquibase (please note you need to include the dev or prod profile explicitly)
  • With a packaged application: ./java -jar jhipster-0.0.1-SNAPSHOT.war,no-liquibase

With Maven, you can also use those profiles directly:

  • ./mvnw -Pprod,swagger,no-liquibase
  • ./mvnw -Pdev,no-liquibase

With Gradle, you can also use those profiles directly:

  • ./gradlew -Pprod -Pswagger -Pno-liquibase
  • ./gradlew -Pno-liquibase