본문 바로가기
반응형

Web Programing!299

[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.
MySQL RECURSIVE TREE메뉴 추출 1. 테이블, 데이터 생성 CREATE TABLE tree ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(50) NOT NULL, parent_id INT DEFAULT NULL, PRIMARY KEY (id), FOREIGN KEY (parent_id) REFERENCES tree(id) ON DELETE CASCADE ); INSERT INTO tree (name, parent_id) VALUES ('Root', NULL); INSERT INTO tree (name, parent_id) VALUES ('Child 1', 1); INSERT INTO tree (name, parent_id) VALUES ('Child 2', 1); INSERT INTO tree (n.. 2023. 8. 16.
반응형