본문 바로가기

반응형

Spring

(70)
Spring Boot 프로젝트 properties 암복호화 처리 구현하기 Spring Boot 프로젝트에서 암복호화 사용에 대해 https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.encrypting Spring Boot를 사용할 경우 properties의 값의 암호화를 위한 기본 지원을 제공하지 않는다. 다만 Spring Environment에 포함된 값을 수정하는데 필요한 hook point를 제공한다. EnvironmentPostPropcessor interface를 구현하여 application이 start 하기 전에 environment를 조작할 수 있다. 따라서 EnvironmentPostProcessor를 통해 properties의 값..
Spring Boot 3.1 Release Notes 전체 Release Notes 목록은 이곳에서 확인할 수 있습니다. https://luvstudy.tistory.com/tag/Release%20Notes https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.1-Release-Notes 19 revision 기준으로 작성됨 Upgrading from Spring Boot 3.0 Dependency Management for Apache HttpClient 4 Spring Framework 6에서는 Apache HttpClient 5를 선호하기 위해 RestTemplate 을 사용하는 Apache HttpClient 4에 대한 지원이 제거되었습니다. Spring Boot 3.0에는 HttpC..
spring-asciidoctor-backends 사용해 보기 spring-asciidoctor-backends 소개 spring으로 개발하면 spring documentation을 자주 보게 된다. https://docs.spring.io/spring-framework/docs/current/reference/html/ 이 문서는 asciidoctor를 사용하여 만들어졌다. java maven에서는 asciidoctor-maven-plugin을 사용하여 문서를 생성한다. https://asciidoctor.org/ spring-asciidoctor-backends는 asciidoctor-maven-plugin dependency에 추가하는 라이브러리로 spring documentation 생성 시 필요한 몇 가지 기능과 문서 스타일을 제공한다. 이전에 spring..
springdoc-openapi swagger @ExampleObject annotation 사용해 보기 swagger annotation을 사용하여 문서화 작업을 하면 너무 많은 양의 swagger annotation이 오히려 코드의 가독성을 많이 떨어트리게 되어 이에 대해 좀 더 정리하여 사용해보려고 한다. swagger annotation에 대한 자세한 설명은 아래 github wiki에 있다. https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations 설정하기 spring boot 프로젝트에서 springdoc-openapi의 사용은 다음과 같이 의존성을 추가하면 된다. webmvc의 경우 아래 dependency를 추가하고 webflux인 경우 springdoc-openapi-starter-webflux-ui를 추가하면 된다..
Spring Data의 Pageable parameter로 사용하기 Spring Data의 Pageable을 사용한 경우 이 pageable 객체를 parameter로 받아 처리하고 싶은 경우가 있다. 예를 들어 게시글 목록을 조회하는 경우 다음과 같은 controller를 사용한다고 하면 @GetMapping("/findByBoardAlias") public Page findByBoardAlias(@RequestParam String boardAlias, Pageable pageable) { return boardArticleService.findByAlias(boardAlias, pageable); } 위와 같이 getmapping에서 Pageable을 처리하게 된다. 위의 호출을 예를 들어 단순히 boardAlias로만 조회를 하는 경우 다음과 같이 호출한다. /f..
Spring Boot 프로젝트 logback accesslog 설정하기 (Tomcat Servlet 기준) Spring Boot Logback 사용 기본 설정 Spring Boot를 사용한 application에서 로그를 사용하려면 다음 dependency를 추가한다. (현재는 logback이 기본 참조되어 있는데 과거엔 log4j -> slf4j가 기본 설정이었다.) org.springframework.boot spring-boot-starter-logging Spring Boot가 제공하는 logback 기본 설정 위치는 spring boot의 base.xml 파일이며 다음과 같다. https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot/src/main/resources/org/springframewor..
Spring Session 사용해 보기 소개 https://docs.spring.io/spring-session/reference/index.html Spring Security를 사용하여 로그인을 하면 기본 설정이 세션 정보를 해당 application의 ConcurrentMap에 들고 있게 된다. 단일 서버가 아닌 여러 대의 서버로 운영하고 있다면 세션 정보를 여러 서버가 같이 공유할 수 있어야 한다. Spring Session은 사용자의 session 정보를 공유하기 위한 API 및 구현체를 제공한다. Spring Session은 Redis, JDBC, Hazelcast, MongoDB에 대한 모듈을 제공한다. (Apache Geode는 문서에 따로 나와 있는데 왜 에 대한 지원은 3.0.0에 보이지 않았다.) 이 글을 작성하는 당시(2..
Spring Boot Thymeleaf 사용해 보기 thymeleaf도 하도 오래간만에 보니 새로 배우는 느낌이어서 정리하면서 써보려고 한다. FE, BE가 완전히 분리되지 않는다는 게 단점이지만 반대로 보면 Thymeleaf가 BE와 연동이 매우 쉽다는 것이 장점이기도 하다. Spring Boot에서 Thymeleaf 사용하기 기본 사용 Spring Boot에서 Thymeleaf를 사용하려면 다음 dependency를 추가하면 된다. org.springframework.boot spring-boot-starter-thymeleaf 이 dependency를 추가하면 Spring Boot AutoConfigure는 Thymeleaf를 사용할 수 있는 기본적인 설정을 제공해 준다. 현재 spring-boot-starter-thymeleaf는 thymeleaf..

반응형