Creating an application
Please check our video tutorial on creating a new JHipster application!
Quick start
First of all, create an empty directory in which you will create your application:
mkdir myapplication
Go to that directory:
cd myapplication/
To generate your application, type:
jhipster
Answer the questions asked by the generator to create an application tailored to your needs. Those options are described in the next section.
Once the application is generated, you can launch it using Maven (./mvnw
on Linux/MacOS/Windows PowerShell, mvnw
on Windows Cmd) or Gradle (./gradlew
on Linux/MacOS/Windows PowerShell, gradlew
on Windows Cmd).
If you are using Maven and changed front end files after first run of the ./mvnw
command then you must run ./mvnw -Pwebapp
to see the latest front end version (Gradle detects front end changes automatically and recompiles front end if needed).
The application will be available on http://localhost:8080
If you want to have "live reload" of your JavaScript/TypeScript code, you will need run npm start
. You can go to the Using JHipster in development page for more information.
If you are using "live reload" then you can speed up server start up by excluding client side tasks by ./mvnw -P-webapp
or ./gradlew -x webapp
. It speeds up especially Gradle.
Questions asked when generating an application
Some questions change depending on the previous choices you have made. For example, you won't need to configure an Hibernate cache if you didn't select an SQL database.
Which type of application would you like to create?
Your type of application depends on whether you wish to use a microservices architecture or not. A full explanation on microservices is available here, if unsure use the default "Monolithic application".
You can either use:
- Monolithic application: this a classical, one-size-fits-all application. It's easier to use and develop, and is our recommended default.
- Microservice application: in a microservices architecture, this is one of the services.
- Microservice gateway: in a microservices architecture, this is an edge server that routes and secures requests.
What is the base name of your application?
This is the name of your application.
What is your default Java package name?
Your Java application will use this as its root package. This value is stored by Yeoman so that the next time you run the generator the last value will become default. You can override it by providing a new value.
Which type of authentication would you like to use?
Here are all the possible options:
- JWT authentication: use a JSON Web Token (JWT), which is the default choice and what most people use.
- OAuth 2.0 / OIDC Authentication: this uses an OpenID Connect server, like Keycloak, Auth0, or Okta, which handles authentication outside the application. This is more secured than JWT, but it requires to set up an OpenID Connect server, so it's a bit more complex. Please note that by default JHipster will synchronize the user data from the OpenID Connect server, and for this it will need a database.
- HTTP Session Authentication: the classical session-based authentication mechanism, which is what people usually do with Spring Security.
You can find more information on our securing your application page.
Which type of database would you like to use?
You can choose between:
- An SQL database (H2, MySQL, MariaDB, PostgreSQL, MSSQL, Oracle), which you will access with Spring Data JPA
- MongoDB
- Cassandra
- Couchbase
- Neo4j
- No database (only available when using a microservice application with JWT authentication)
Which production database would you like to use?
This is the database you will use with your "production" profile. To configure it, please modify your src/main/resources/config/application-prod.yml
file.
If you want to use Oracle, you might need to be aware of current limitations when using Oracle database.
Which development database would you like to use?
This is the database you will use with your "development" profile. You can either use:
- H2, running in-memory. This is the easiest way to use JHipster, but your data will be lost when you restart your server.
- H2, with its data stored on disk. This is a better option than running in-memory, as you won't lose your data upon application restart.
- The same database as the one you chose for production: it's a bit more complex to set up, but it should be better in the end to work on the same database as the one you will use in production. This is also the best way to use liquibase-hibernate as described in the development guide.
To configure it, please modify your src/main/resources/config/application-dev.yml
file.
Do you want to use the Spring cache abstraction?
The Spring cache abstraction allows to use different cache implementations: you can use ehcache (local cache), Caffeine (local cache), Hazelcast (distributed cache), Infinispan (distributed cache), Memcached (another distributed cache) or Redis (configured as a single server cache). This can have a very positive impact on your application's performance, and hence it is a recommended option.
Do you want to use Hibernate 2nd level cache?
This option will only be available if you selected to use an SQL database (as JHipster will use Spring Data JPA to access it) and selected a cache provider in the previous question.
Hibernate is the JPA provider used by JHipster, and it can use a cache provider to greatly improve its performance. As a result, we highly recommend you to use this option, and to tune your cache implementation according to your application's needs.
Would you like to use Maven or Gradle?
You can build your generated Java application either with Maven or Gradle. Maven is more stable and more mature. Gradle is more flexible, easier to extend, and more hype.
Which other technologies would you like to use?
This is a multi-select answer, to add one or several other technologies to the application. Available technologies are:
API first development using swagger-codegen
This option lets you do API-first development for your application by integrating the Swagger-Codegen into the build.