This exercise is a RESTful API to work as a basic message store.
- Use Git to clone this repo.
- To build the project:
./mvnw clean install
. - To serve it:
./mvnw spring-boot:run
. - To test:
http://localhost:8080
. - To shutdown: send
POST
tohttp://localhost:8080/actuator/shutdown
The project is built with Spring Boot using these Starters and dependencies:
- Web - Full-stack web development with Tomcat.
- JPA - Java Persistence API including spring-data-jpa, spring-orm and Hibernate
- H2 - H2 database (with embedded support)
- HATEOAS - HATEOAS-based RESTful services
- DevTools - Spring Boot Development Tools
The embedded database is initialized automatically at startup. This is
enabled by placing the data.sql file in the src/main/resources
folder.
-
POST: /actuator/shutdown
Shuts down the server.
http://localhost:8080/actuator/shutdown -
GET: client/{client_id}
Retrieves a client by its id.
http://localhost:8080/client/1 -
GET: message/messageid:{message_id}
Retrieves a message by its id.
http://localhost:8080/message/messageid:1 -
GET: message/messageid:{message_id}/clientid:{client_id}
Retrieves a message of a client.
http://localhost:8080/message/messageid:1/clientid:1 -
GET: message/clientid:{client_id}
Retrieves all available messages of a client.
http://localhost:8080/message/clientid:1 -
POST: message/clientid:{client_id}
Creates a new message for given client. -
PUT message/messageid:{message_id}/clientid:{client_id}
Creates a message for given client.
Spring Initializr
Building REST Services with Spring
Shutdown a Spring Boot Application