diff --git a/src/main/java/br/com/beblue/musicstore/controller/rest/DiscRestController.java b/src/main/java/br/com/beblue/musicstore/controller/rest/DiscRestController.java index 3b11105..1a97fba 100644 --- a/src/main/java/br/com/beblue/musicstore/controller/rest/DiscRestController.java +++ b/src/main/java/br/com/beblue/musicstore/controller/rest/DiscRestController.java @@ -4,6 +4,9 @@ import br.com.beblue.musicstore.controller.dto.DiscDTO; import br.com.beblue.musicstore.exception.NoValuePresentException; import br.com.beblue.musicstore.service.DiscService; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.MediaType; @@ -15,6 +18,7 @@ @RestController @RequestMapping(DiscRestController.ROOT_PATH) +@AllArgsConstructor(access = AccessLevel.PACKAGE, onConstructor = @__(@Autowired)) class DiscRestController implements DiscController { static final String ROOT_PATH = "/disc"; @@ -23,10 +27,6 @@ class DiscRestController implements DiscController { private final DiscService discService; - DiscRestController(final DiscService discService) { - this.discService = discService; - } - @GetMapping(value = PATH_BY_GENRE, produces = MediaType.APPLICATION_JSON_VALUE) public Page listDiscsByGenre(@PathVariable final String genre, final Pageable pageable) { return discService.getDiscsByGenre(genre, pageable); diff --git a/src/main/java/br/com/beblue/musicstore/controller/rest/GenreRestController.java b/src/main/java/br/com/beblue/musicstore/controller/rest/GenreRestController.java index 1318a41..2437a44 100644 --- a/src/main/java/br/com/beblue/musicstore/controller/rest/GenreRestController.java +++ b/src/main/java/br/com/beblue/musicstore/controller/rest/GenreRestController.java @@ -3,6 +3,9 @@ import br.com.beblue.musicstore.controller.GenreController; import br.com.beblue.musicstore.controller.dto.GenreDTO; import br.com.beblue.musicstore.service.GenreService; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -12,16 +15,13 @@ @RestController @RequestMapping(GenreRestController.ROOT_PATH) +@AllArgsConstructor(access = AccessLevel.PACKAGE, onConstructor = @__(@Autowired)) class GenreRestController implements GenreController { static final String ROOT_PATH = "/genre"; private final GenreService genreService; - GenreRestController(final GenreService genreService) { - this.genreService = genreService; - } - @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) public List getAllGenres() { return genreService.getAllGenres(); diff --git a/src/main/java/br/com/beblue/musicstore/controller/rest/SaleRestController.java b/src/main/java/br/com/beblue/musicstore/controller/rest/SaleRestController.java index 6f939db..4e33cb1 100644 --- a/src/main/java/br/com/beblue/musicstore/controller/rest/SaleRestController.java +++ b/src/main/java/br/com/beblue/musicstore/controller/rest/SaleRestController.java @@ -7,6 +7,9 @@ import br.com.beblue.musicstore.exception.NoValuePresentException; import br.com.beblue.musicstore.service.SaleSearchService; import br.com.beblue.musicstore.service.SaleService; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.format.annotation.DateTimeFormat; @@ -16,6 +19,7 @@ @RestController @RequestMapping(SaleRestController.ROOT_PATH) +@AllArgsConstructor(access = AccessLevel.PACKAGE, onConstructor = @__(@Autowired)) class SaleRestController implements SaleController { static final String ROOT_PATH = "/sale"; @@ -25,12 +29,6 @@ class SaleRestController implements SaleController { private final SaleService saleService; private final SaleSearchService saleSearchService; - SaleRestController(final SaleService saleService, - final SaleSearchService saleSearchService) { - this.saleService = saleService; - this.saleSearchService = saleSearchService; - } - @PostMapping() public SaleResponseDTO registerOrder(@RequestBody final SaleRequestDTO request) throws NoValuePresentException { return saleService.registerOrder(request);