The document discusses implementing various features in a RESTful web service built with Spring Boot, including returning beans from endpoints, adding path variables, creating and accessing user resources, implementing GET, POST, DELETE methods, exception handling, validations, HATEOAS, internationalization, and content negotiation.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
32 views
Spring Project Steps
The document discusses implementing various features in a RESTful web service built with Spring Boot, including returning beans from endpoints, adding path variables, creating and accessing user resources, implementing GET, POST, DELETE methods, exception handling, validations, HATEOAS, internationalization, and content negotiation.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12
Instead of @GetMapping @RequestMappling
Enhance Hellowordservce to return a bean
Create a HelloWorldBean with some message .
3) Quick review of Spring Boot Auto Configuration and Dispatcher servlet
4) path variable
5) Creating user Bean and user service
Add couple of methods with it 6) Implementing GET method for user Resource 7) Implimenting POST method to create user resource
For post request in postman we need to provide default constructor for users bean
7) Enhancing POST Method to return correct HTTP status code and
location 11) Implementing Exception Handling --404 Resource not found
12) Implementing Generic Exception Handling for All Resources
Generate Getters and setters as well
Same
13) Exercise user post Resource and Exception Handling
Try to thing and write Exception handling for all these three resources.
14) Implementing Delete method to delete a user Resource
In Controller service add the code below
15) Implementing Validations for REST ful Services
Under UserResourse.java
16) Implementing HATEOS for Restfull Services
(HyperMedia as the Engine state) In pom.xml add the below dependency to support HATEOS
In UserResource and for retriveAll method we use this HETIOS
Output in postman will be
17) Overview of Advanced Restful service Features
How do you internationalize Restful web services? How do you do content negotiation? How do you do vertioning? How do you filter JSON? Don’t want to send a specific bean back How do you document my webservices How do I monitor my webservices
18) Internationalization for RestFul Services
Need to configure another bean in
Rightclick on src/main/resources and create message.properties file