If you want to use JHipster with the "production" profile, use the pre-configured "prod" Maven profile:
mvn -Pprod spring-boot:run
Or when using Gradle:
gradlew -Pprod bootRun
This profile will compile, test and package your Java application with all productions settings. It will also trigger a "grunt build", so your static resources are optimized.
If you want more information on the available profiles, please go the section titled "Development and Production profiles".
To package the application as a "production" WAR, type:
mvn -Pprod package
Or when using Gradle:
gradlew -Pprod bootRepackage
This will generate two files (if your application is called "jhipster"):
The first one is an executable WAR file (see next section to run it). It can also be deployed on an application server, but as it includes the Tomcat runtime libs, you will probably get some warnings, that's why we recommend you use the second, ".original" file if you want to deploy JHipster on an application server.
Once you have deployed you WAR file on your application server:
JAVA_OPTSwhen running your server)
Instead of deploying on an application server, many people find it easier to just have an exectuable WAR file (which includes Tomcat 7, in fact).
The first WAR file generated in the previous step is such a WAR, so you can run it in "development mode" by typing:
java -jar jhipster-0.0.1-SNAPSHOT.war
Or in "production" mode:
java -jar jhipster-0.0.1-SNAPSHOT.war --spring.profiles.active=prod
This step is automatically triggered when you build your project with the "production" profile. If you want to run it without launching a Maven build, just run:
This application will be generated in your
src/main/webapp/dist folder, which by default is not checked in your Git repository (see your
.gitignore file if you want to change this behavior).
This code will be served when you run the application with the "production" profile.
With the "production" profile, JHipster configures a Servlet filter that applies gzip compression on your resources.
By default, this filter will work on most static resources (excluding images, which are already compressed) and on all REST requests.
JHipster comes with full monitoring support from Metrics.
In development, Metrics data will be available through JMX: launch your JConsole and you will be able to access it
In production, your application will try to send this data to a Graphite server, if you have configured one in your YAML configuration file.
JHipster comes with some default users generated for you. In production, you probably want to change their passwords: the easiest way to achieve this is to run the application a first time, and then use the generated "change password" form to modify those passwords.
Here are the provided user accounts: