-
Notifications
You must be signed in to change notification settings - Fork 0
Restful Web Services with Spring Boot Part I
Amitha R edited this page Dec 17, 2020
·
8 revisions
- start.spring.io
- Provide details:
- Maven Project, Java, SpringBoot - 2.0.0(SNAPSHOT)
- Group : com.example.project
- Artifact : restful-web-services
- dependencies : Web , DevTools, JPA, H2
-
Generate Project
-
For any Maven project need to specify a group id and artifact id.
-
Spring Initializer creates a Maven Project, puts it in a Zip and downloaded to the downloads folder.
-
In eclipse -> Import -> Existing Maven Project
- Load the maven project.
- Maven would download all the dependencies listed in the pom.xml file.
- REST is a style of software architecture for distributed hypermedia systems (design resources and how you expose them using HTTP).
- REST makes best use of HTTP.
- Key abstraction is a resource - each resource has a URI. ** (Users (1) - Posts(Many))
- Different RESTful Web services we would create.
- Retrieve all Users - GET /users
- Create a User - POST /users
- Retrieve one User - GET /users/{id} -> /users/1
- Delete a User - DELETE /users/{id} -> /users/1
- Retrieve all posts for a User - GET /users/{id}/posts
- Create posts for a User - POST /users/{id}/posts
- Retrieve details of a post - GET /users/{id}/posts/{post_id}
- Class object that in turn returns a String.
- Getter, Setter and toString Method.
- Without a Getter - encounter an error - No converter found for return value of type.