diff --git a/pom.xml b/pom.xml index c59a9aed6..a02e6bf2f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.0.2 + 3.2.3 guru.springframework @@ -14,7 +14,7 @@ spring-6-rest-mvc spring-6-rest-mvc - 17 + 21 diff --git a/src/main/java/guru/springframework/spring6restmvc/model/Beer.java b/src/main/java/guru/springframework/spring6restmvc/model/Beer.java new file mode 100644 index 000000000..1aed54c28 --- /dev/null +++ b/src/main/java/guru/springframework/spring6restmvc/model/Beer.java @@ -0,0 +1,25 @@ +package guru.springframework.spring6restmvc.model; + +import lombok.Builder; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.UUID; + +/** + * Created by jt, Spring Framework Guru. + */ +@Builder +@Data +public class Beer { + private UUID id; + private Integer version; + private String beerName; + private BeerStyle beerStyle; + private String upc; + private Integer quantityOnHand; + private BigDecimal price; + private LocalDateTime createdDate; + private LocalDateTime updateDate; +} diff --git a/src/main/java/guru/springframework/spring6restmvc/model/BeerStyle.java b/src/main/java/guru/springframework/spring6restmvc/model/BeerStyle.java new file mode 100644 index 000000000..78a1b30df --- /dev/null +++ b/src/main/java/guru/springframework/spring6restmvc/model/BeerStyle.java @@ -0,0 +1,8 @@ +package guru.springframework.spring6restmvc.model; + +/** + * Created by jt, Spring Framework Guru. + */ +public enum BeerStyle { + LAGER, PILSNER, STOUT, GOSE, PORTER, ALE, WHEAT, IPA, PALE_ALE, SAISON +} diff --git a/src/main/java/guru/springframework/spring6restmvc/services/BeerService.java b/src/main/java/guru/springframework/spring6restmvc/services/BeerService.java new file mode 100644 index 000000000..70ef7fdd3 --- /dev/null +++ b/src/main/java/guru/springframework/spring6restmvc/services/BeerService.java @@ -0,0 +1,13 @@ +package guru.springframework.spring6restmvc.services; + +import guru.springframework.spring6restmvc.model.Beer; + +import java.util.UUID; + +/** + * Created by jt, Spring Framework Guru. + */ +public interface BeerService { + + Beer getBeerById(UUID id); +} diff --git a/src/main/java/guru/springframework/spring6restmvc/services/BeerServiceImpl.java b/src/main/java/guru/springframework/spring6restmvc/services/BeerServiceImpl.java new file mode 100644 index 000000000..d094b3198 --- /dev/null +++ b/src/main/java/guru/springframework/spring6restmvc/services/BeerServiceImpl.java @@ -0,0 +1,28 @@ +package guru.springframework.spring6restmvc.services; + +import guru.springframework.spring6restmvc.model.Beer; +import guru.springframework.spring6restmvc.model.BeerStyle; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.UUID; + +/** + * Created by jt, Spring Framework Guru. + */ +public class BeerServiceImpl implements BeerService { + @Override + public Beer getBeerById(UUID id) { + return Beer.builder() + .id(id) + .version(1) + .beerName("Galaxy Cat") + .beerStyle(BeerStyle.PALE_ALE) + .upc("12356") + .price(new BigDecimal("12.99")) + .quantityOnHand(122) + .createdDate(LocalDateTime.now()) + .updateDate(LocalDateTime.now()) + .build(); + } +}