The REST controller defines URI paths that the service is going to respond to. It declares paths and corresponding HTTP methods that each controller method should react to. We define all of these using annotations. This approach is very similar to JAX-RS with Jersey. Our service has just one, single book resource, so we will have just a single controller for starters. It will be BookController class, defined in the BookController.java:
package pl.finsys.example.controller; import org.springframework.beans.factory.annotation.Autowired; import pl.finsys.example.domain.Book; import pl.finsys.example.service.BookService; import pl.finsys.example.service.exception.BookAlreadyExistsException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; ...