This is a RESTFUL API project using Springboot technology with following method for simple CRUD purposes :
- JPA Repository
- MySQL Database
- Hibernate
- Custom JSON ResponseEntity
- File > New > Maven Project.
- Select project name and location Dialog > Let it be default.
- Select an Archetype > choose maven-archetype-webapp.
- Enter Artifact id > enter your group id for the
package path
and enter your artifact id for yourapp name
. - Click finish and wait the maven update.
- Add parent after
url tag
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.RELEASE</version>
<relativePath/>
</parent>
- Add the dependency in
dependecies tag
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
Notes that web app have a dependency of data-jpa than that project require an application.properties file
- Right click on src/main/resources > new > other
- In create wizard dialog > go to general files > next
- In create new file resources > enter your directory to
src/main/resources
and your file nameapplicaton.properties
# Data Source spring (DtsaSourceAutoConfiguration & data DataSourceProperties)
spring.datasource.url = jdbc:mysql://localhost:3306/exampledb?useSSL=false
spring.datasource.username = root
spring.datasource.password =
# Hibernate Properties
# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
# Hibernate ddl auto (Create, Create-Drop, Validate, Update)
spring.jpa.hibernate.ddl-auto = update
# Tomcat Server PORT
server.port = 8383
- Right click on
maven project root
> properties - On Properties Dialog select > maven build path > then select all on order and export.
- Click Apply and Close
- Make 4 package that are essenssial for springboot, that are : controller, model, repository, and dao
- Right click on
src/main/java
> new > package - Entry the package name and then click finish