A simple CRUD App built on Java, Spring Boot, Thymeleaf and H2, PostgreSQL or MySQL Server database.
https://odemur-spring-boot-crud.herokuapp.com
- Language: Java
- Framework: Spring Boot
- Build Automation Tool: Apache Maven
- Database [default]: H2
- Supported Database: PostgreSQL and MySQL
Clone this project and running on you local machine.
Only for development and testing purposes.
- Java SDK 8
- Java IDE
- Apache Maven (only for Command Line)
Please follow carefully step by step instructions below:
- For PostgreSQL
docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=123 -d postgres
docker exec -it postgres psql -U postgres
- For MySQL
docker run --name=mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123 -d mysql/mysql-server:5.7
docker exec -it mysql mysql -uroot -p
Please create a database with the name: test
CREATE DATABASE test;
git clone https://github.com/odemur/java-spring-boot-crud.git
- Add PostgreSQL dependencies on file pom.xml
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
- Edit the file "application.properties" on the directory "src/main/resorces".
Parameters for PostgreSQL
spring.datasource.url = jdbc:postgresql://localhost:5432/test
spring.datasource.username = postgres
spring.datasource.password = 123
spring.jpa.hibernate.ddl-auto = update
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
- Add MySQL dependencies on file pom.xml
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
- Edit the file "application.properties" on the directory "src/main/resorces".
Parameters for MySQL
spring.datasource.url = jdbc:mysql://localhost:3306/test
spring.datasource.username = root
spring.datasource.password = 123
spring.jpa.hibernate.ddl-auto = update
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
There is a file called users.json in the src/main/resources/json directory with sample data.
- Open this project folder with any Java IDE (IntelliJ IDEA, Eclipse, etc..)
- Run the application using the IDE > Run Option
- Open Terminal
- Change directory to the base project (spring-boot-rest-api)
- Run the command
mvn java-spring-boot-crud:run
Open http://localhost:8080/ in your browser.