diff --git a/pom.xml b/pom.xml index 1c8f67d..d3a651b 100644 --- a/pom.xml +++ b/pom.xml @@ -21,8 +21,8 @@ - org.hibernate.validator - hibernate-validator + org.springframework.boot + spring-boot-starter-validation org.springframework.boot diff --git a/src/main/java/org/bookstore/dto/CreateBookRequestDto.java b/src/main/java/org/bookstore/dto/CreateBookRequestDto.java index 79997a1..2eb6e91 100644 --- a/src/main/java/org/bookstore/dto/CreateBookRequestDto.java +++ b/src/main/java/org/bookstore/dto/CreateBookRequestDto.java @@ -1,21 +1,21 @@ package org.bookstore.dto; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.PositiveOrZero; import java.math.BigDecimal; -import lombok.Data; -@Data -public class CreateBookRequestDto { - private Long id; +public record CreateBookRequestDto( + Long id, + @NotBlank String title, @NotBlank - private String title; + String author, @NotBlank - private String author; - @NotBlank - private String isbn; + String isbn, + @NotNull @PositiveOrZero - private BigDecimal price; - private String description; - private String coverImage; -} + BigDecimal price, + String description, + String coverImage +) +{}