Crud App with Spring Boot
Objective
In this tutorial, I will show you how to build a crud app using Spring Boot .
Environment
Java
Spring boot
Mysql
Spring Boot
- Java version
java -version
- Create a Java app with Spring Initializr
- Generate Java Spring App
- Open Java Spring App with IntelliJ IDEA
- Add model repository controller exception packages
- Add User class
- Add UserRepository
- Mysql workbench
create database data;
- configure database connection with JDBC driver application.properties
- Run Spring Boot
- Result MySQL Workbench
show databases;
use data;
desc user;
- Add UserController class to send data in the database with postMapping
- Run java spring boot port 8080
- Postman: create a new collection
- new request send POST user localhost port 8080
- view data in MySQL Workbench select from user
- GetMapping for getting data from the database
- new request Postman get users localhost port 8080
- GetMapping: view user by id
- Exception
- Test view user by Postman
- PutMapping spring: edit user by id
- Delete Mappin spring: delete a user by id
- delete user by id postman