본문 바로가기
반응형

Web Programing!/JAVA / JSP85

[Springboot] Message properties 사용 @Data public class Dto { @NotNull(message="name must not be null") private String name; .... } 위와 같은 방식으로 DTO에 message를 하드코딩해서 각 항목별로 validation을 수행할 수 있지만 관리적인 측면이나 다국어 적용시 이는 문제가 될 수 있다. 이를 해결하기 위해 Spring에서 message를 사용하듯이 code(key) 값을 넣어서 별도의 공간에 정의되어 있는 message를 가지고 오고자 한다. classpath:/messages/validation.properties name.notnull=name must not be null​ message.properties 파일에 넣어도 되지만 validation .. 2023. 8. 21.
[Springboot] API Docs (Swagger3, Springdoc) (2) Springdoc 옵션 ​ Springdoc 공식 사이트 참조 : https://springdoc.org/ OpenAPI 3 Library for spring-boot Library for OpenAPI 3 with spring boot projects. Is based on swagger-ui, to display the OpenAPI description.Generates automatically the OpenAPI file. springdoc.org OpenAPI Annotation ​swagger 2 annotations과 swagger 3 annotations의 차이는 아래와 같다. Springdoc은 swagger 3 annotation을 사용하고 있다. swagger 3 annotation.. 2023. 8. 18.
[Springboot] API Docs (Swagger3, Springdoc) (1) 1. pom.xml - dependency 추가 (버전은 알아서..) org.springframework.cloud spring-cloud-starter-openfeign 4.0.3 참고 : https://springdoc.org/ OpenAPI 3 Library for spring-boot Library for OpenAPI 3 with spring boot projects. Is based on swagger-ui, to display the OpenAPI description.Generates automatically the OpenAPI file. springdoc.org 3. application.yml - springdoc 설정 springdoc: api-docs: groups: enabled.. 2023. 8. 18.
JPA - 객체지향 쿼리 언어 - Criteria 집합, 정렬, 조인 - 집합 Criteria 에서 집합(group by) 과 집합의 조건(having) 을 어떻게 사용하는지 예제를 통해 알아보자. group by 를 사용해보기 위해 기존 Member 엔티티에 age 속성을 더해주고, Address 를 함께 사용한다. Embedded 타입에 equals 와 hasCode 재정의 해 주는것도 잊지말자. @Entity public class Member extends DateMarkable{ @Id @GeneratedValue @Column(name = "MEMBER_ID") private Long id; private int age; private String name; @Embedded private Address address; @OneToMany(mappedBy = ".. 2022. 3. 24.
반응형