Create a RESTful Web Service in Spring

Slack Discussion Repositories https://github.com/terawarehouse/terawarehouse-catalog https://github.com/terawarehouse/terawarehouse-react ...



Slack Discussion
Repositories
To prepare the project from future development, we will be creating a multi-maven project layout. Unfortunately, there’s no automated way to do that, so we will start by creating the root pom. It contains the group name, artifact name, etc, and most importantly packaging which is set to pom. This is how it looks like [refer to the folder].

It’s now time to set up our very first RESTful web service project.
  1. Open Spring Tool Suite 4
  2. Click File / New / Other and select Spring Starter Project
  3. Set
    1. Name=terawarehouse-catalog
    2. Group=com.broodcamp
    3. Artifact=terawarehouse-catalog
    4. Description=Catalog Manager Service
    5. Package=com.terawarehouse.catalog
    6. Working set=terawarehouse
  4. Click Next
  5. In New Spring Project Dependencies windows select
    1. H2 Database
    2. REST Repositories HAL Browser
    3. Spring Data JPA
    4. Lombok
    5. Spring Boot Actuator
    6. Spring HATEOAS
    7. Rest Repositories
    8. Spring Boot DevTools
    9. Spring Web Starter
  6. Click Next and then Finish.
We will discuss their usage as we go along with the project.

Run the application by:
  1. Right click on the project
  2. Select Run As
  3. Spring Boot App
By default, the application will run on port 8080. Let’s open it in the browser. This is where one of our dependencies kick in, the HAL Browser, which lists the  API for Spring data.

Next, we will take a look at Actuator which is accessible at /actuator. It exposes a default set of APIs that provide the health information of the project. Let’s try /actuator/health.

More APIs can be exposed by changing the security configuration in the application.properties file. Set management.endpoints.web.exposure.include=*. After changing the file note that Spring STS will automatically update and redeploy the application. So we just need to refresh the page.

The list of exposed APIs should now be updated and must contain cache, login, metrics and so on [open metrics]. We can use these APIs to monitor our service.

COMMENTS

mas template
Name

amazon,1,angular,8,bigdata,2,business,1,course-spring,27,courses,6,database,4,docker,3,java,50,kafka,1,keycloak,4,microservices,5,mysql,1,neworking,1,nosql,2,php,1,pinned,2,react,3,server management,7,shared drive,1,spring,7,synology,1,troubleshooting,2,web,1,wordpress,1,
ltr
item
toztech: Create a RESTful Web Service in Spring
Create a RESTful Web Service in Spring
https://i.ytimg.com/vi/JGxOGHlhCnc/0.jpg
https://i.ytimg.com/vi/JGxOGHlhCnc/0.jpg
toztech
https://toztech.blogspot.com/2019/06/create-restful-web-service-in-spring.html
https://toztech.blogspot.com/
https://toztech.blogspot.com/
https://toztech.blogspot.com/2019/06/create-restful-web-service-in-spring.html
true
2554149350007112447
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content