From 553a5b12035e9fbb94d63d1701fc1683aeef39d6 Mon Sep 17 00:00:00 2001 From: Vyacheslav Date: Sun, 22 Oct 2023 00:30:56 +0300 Subject: [PATCH] Added dependency, CreateBookRequestDto converted to record --- pom.xml | 4 ++-- .../bookstore/dto/CreateBookRequestDto.java | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) 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 +) +{}