From https://start.spring.io, as a Maven project, Spring boot 2.4.4,Java version 8. I added 3 dependencies(Web,JPA and H2) to Spring boot and downloaded JAR file.
I imported JAR file as Existing Maven Project and created new project.
I started create my object USER firstly.Initialized private ID and public name .Then overrided equals,hash,toString methods. Then wrote UserController where we use CRUD operations.
Then wrote LoadDatabase to configurate logs and database. And interface of UserRepository. Lastly created an exception handling of "user not found" and wrote HTTPStatus to give a exception message in a different class(UserNotFoundAdvice.java). We've done with coding. Run this code on to start server and check from http://localhost:8080/users/
Created a collection then; used GET request on http://localhost:8080/users/ URL. used PUT request to add new user:
used POST request to update user:
used DELETE request to delete user
used GET request to check users.
Uploaded my whole Java code to Github. By https://www.youtube.com/watch?v=nHk53YnrE5k
I connected my Heroku account to Github. Then deploy manually and choose main branch. But I got error with Java version. So I went back to my code and changed java version from 15 to 1.8 on "pom.xml". Finally I deployed my code and get this link : https://spring-restfulapi-demo.herokuapp.com/users
I usually used REST tutorial of Spring from: https://spring.io/guides/tutorials/rest/