---
# System prepended metadata

title: ATLAS - Rest API with Spring boot (part 3)

---

# ATLAS - Rest API with Spring boot (part 3)

## Context
See [part 1](https://hackmd.io/OAcft3gBT0SkV-SF__rGeg) for details on the context.

## Prerequisites
Finish [part 2-bis](https://hackmd.io/qgUpWnV4SYy3aEchvASE3Q).

## Specifications

### Refactor the "POST" routes
Change the behaviour of the routes in order to return the newly "created entity" UUID, instead of nothing.

### Refactoring to services

- Create a new Java package to group the service classes
- Create a new "service" class for each entity
- Expose the "save", "update", "delete" and "get" Java methods in each service in order to "save", "update", "delete" and "get" the related entity
- The "save", "update", "delete" and "get" methods in the service layer will now execute the "business logic"; that is use the database in order to "save", "update", "delete" and "get" (exactly what the controller used to do)
- Change each existing controller in order to inject its related service and delegate the "business logic" to the service (calling the service's method) instead of calling the database

**Test!**:
The behaviour of the application should be exactly the same as before the refactoring!

### New route to update partially a country
Add a route in order to update partially a country. The new route should only update given data:
- Population
- Area
- Official language

### New route to update partially a continent
Add a route in order to update partially a continent. The new route should only update given data:
- Area

### New route to update partially a capital
Add a route in order to update partially a capital. The new route should only update given data:
- Population
- Area

### New entity "River"
Create a new River entity with given data:
- Name
- Length (in km)
- Source
- Mouth

Implement all the required classes and methods in order to create, get by id, delete by id, update (fully) and update partially (length, source, mouth) a river.