JHipster is an scaffolding tool developed by Yeoman and used to develop Spring Boot + AngularJS projects. The present post intends to guide you on how to create a new web application step by step.
Before starting with our application, you must be sure that you cover the following requirements:
- Install and configure Java 8 on your system.
- Install Node-js from its website, this will also install npm.
- Install Yeoman using npm install –g yo.
- Install Bower using npm install –g bower.
- Install Gulp using npm install –g gulp-cli.
- Install JHipster using npm install –g generator-jhipster.
With this simple steps JHipster has been successfully installed.
Creating an application
Once you have JHipster installed in your system, follow the next steps to create your new application.
- Create an empty directory where the project is going to be allocated.
- Go to the new directory.
- Create a new application using the following command:
- JHipster will ask for authorization to send anonymously a report of usage statistics, you can decide this according to your preference.
- The type of application you want to create, for this post we will choose Monolithic application.
- Application name:
- Base package name:
- Authentication type:
- HTTP Session Authentication (stateful, default Spring Security Mechanism).
- Data Base type:
- Data Base to be used in production:
- Data Base to be used in development:
- Are you planning to use a second layer of cache on Hibernate?:
- Yes, with ehcache (local cache for a single node).
- Building tool:
- Additional Tools:
- Use LibSass for CSS files processing:
- Internationalization Support:
- No. (By saying yes you will have to choose a native language and then additional languages you would like to install).
- Testing framework:
- Override .gitignore file:
Once you are done with the initial configuration JHipster will generate the complete application displaying the following message:
Running the application
Up to now we should have a full project ready to be configured, compiled and run. To do this, we require some additional steps:
- Compile the project using mvn clean install.
- Create an empty data base for the project.
- Modify the project configurations in the file application-dev.yml located on src/main/resources/config, in this post you have to fill the DB Url, DB User and password.
- To execute the project you can run inside your IDE the RaidentranceApp.java as Spring Boot Application or you can use the command mvn spring-boot:run
Now you will be able to open a browser and look for http://127.0.0.1:8080 to retrieve the Welcome page from JHipster containing: In the top-left corner the profile that is being used (dev) and an account tab to register new users or use an existent account.
By default JHipster will generate an admin user with password admin, once you are authenticated you should see the following screen:
This screen will contain different sections described below:
- Entities: here you will see the entities defined for the project, at the very beginning this is going to be empty since we haven’t created anyone.
- Settings: Used to modify the username, last name and e-mail.
- Password: Used to change the current user password.
- Sessions: Shows the active sessions.
- Sign Out.
- User management: Will allow you to view an modify your user accounts.
- Metrics: Shows application metrics such as the number of http requests, use of the REST web services, cache and use of datasource.
- Health: Shows the checks defined by the application.
- Configuration: Shows all the current configurations for the application.
- Audits: Allows you to enable and check entity audits.
- Logs: Used to change the log levels on the application.
- API: Shows the web services in the application together with a brief description on how to use each one of them.
All the features showed were created following development best practices by only executing one command and completing a quick wizard.
On the next post we will explain how to create new Web Pages , the idea will be to create a complete application piece by piece and in just a couple of minutes.
Author: Alejandro Agapito Bautista
Translated By: Oscar Camacho – melchior01