1. What are REST Services
-> A lightweight approach of communication between different apps
-> REST is language independent
-> REST works with any data format, but JSON is the most popular
2. JSON
- An object:
{
"name": value
}
Names of the object's attributes are always in double quote, value is in double quote if it is a string
4 HTTP methods: Post(Create), GET(Read), PUT(Update), DELETE(delete)
3. Spring Rest Controller
Development process:
- Add Maven dependency for Spring Boot starter web
- Create Spring Rest Service using
@RestController
(manually), instead you can use Rest's auto configuration, see in section 6
4. API Desgin Process
- Review API's requirements
- Identify main entity/resource
- Use Http methods to assign action on resource
5. Spring JPA
Automatically give CRUD operations on entities
- Extend
JPARepository
interface and plug in your entity and primary key - Use your repository
6. Spring Data Rest
You only need to add spring-boot-starter-data-rest
dependency to your pom.xml file, Spring will give REST CRUD operations
Top comments (0)