본문 바로가기
728x90
반응형

spring58

[SpringBoot] JPA Comment (주석 추가) 설정 방법 JPA Comment (주석 추가) 설정 방법 application.yml spring: jpa: properties: hibernate: show_sql: false format_sql: true use_sql_comments: true# sql comments 사용 1. JPA Repository에 적용 방법 To apply JPA QueryHints to the queries declared in your repository interface you can use the QueryHints annotation. It takes an array of JPA QueryHint annotations plus a boolean flag to potentially disable the hints applie.. 2024. 2. 2.
[QueryDSL] FullText 검색을 위한 Match ... against 절 사용법 MySQL에서 FullText 인덱스 검색을 하기 위해서는 MATCH(), AGAINST() 절을 사용해야합니다. (풀텍스트 인덱스에 대한 설명은 다른 블로그 포스팅을 참고해주세요.) 기존에 dialect는 MySQL5Dialect를 사용하고 있었습니다. properties.put("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect"); MySQL5Dialect를 커스텀하겠습니다. package com.moonsiri.config.hibernate.dialect; import org.hibernate.dialect.MySQL5Dialect; import org.hibernate.dialect.function.SQLFunctionTemplate; impo.. 2023. 8. 24.
[SpringBoot] QueryDSL org.apache.jasper.JasperException: Unable to compile class for JSP: 배경 JSP를 사용하는 환경에서 QueryDSL 라이브러리를 추가 후 빌드 시 'QueryDSL org.apache.jasper.JasperException: Unable to compile class for JSP:' 오류가 발생 원인 querydsl-apt 내 org.eclipse.jdt.core.compiler:ecj 종속성 강제 해결 querydsl-apt에 org.eclipse.jdt.core.compiler:ecj 종속성 제외 com.querydsl querydsl-apt provided org.eclipse.jdt.core.compiler ecj 2023. 8. 24.
[SpringBoot] JPA Master/Slave 구조 분기 처리 서비스를 운영하다 보면 데이터베이스가 여러 개의 노드로 분산되어 Master/Slave 구조로 이루어져 있는 경우가 많습니다. 보통 두가지 방법으로 분기처리가 가능한데요. 본 포스팅에서는 @Transactional 어노테이션을 사용하는 방식을 소개해드리겠습니다. 먼저 Transactional readOnly에 따라 분기하는 CustomRoutingDataSource를 생성합니다. import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; import org.springframework.transaction.support.TransactionSynchronizationManager; public class RoutingDataS.. 2023. 8. 23.
[WebFlux] Mono에 담긴 List를 하나로 합치기 Spring WebClient를 통해 동일한 객체타입을 리턴하는 여러 외부 API를 호출하면서 Mono를 List로 담았는데, 각 API 호출 응답으로 받은 객체가 List여서 Flux.merge(monoList).collectList() 타입이 Mono이 돼버렸습니다. Mono가 아닌 Mono로 리턴할 수 있는 방법을 알아보겠습니다. 우선 아래 코드를 비교해 확인해 주세요. // AS-IS public Mono getList(...) { List monoList = new ArrayList(); Mono listMono1 = Mono.just(List.of(...)); monoList.add(listMono1); Mono listMono2 = Mono.just(List.of(...)); monoList.. 2023. 7. 13.
[Spring] WebMVC에서 WebFlux 사용 (with WebClient) Spring에는 두 가지 웹 프레임워크가 있습니다. WebMVC : 전통적인 멀티 스레드 기반의 웹 프레임워크 WebFlux : 리액티브 스택 기반의 웹 프레임워크 Spring WebMVC와 WebFlux는 공존할 수 없다고 생각했는데, Spring framework에서 제공하는 Http Client API로 RestTemplate 대신 WebClient를 사용하라고 권고하고 있어서 의문이 생겼습니다. 두 모듈의 공존이 가능한 것인가? Spring 문서를 확인해보면 "애플리케이션은 하나 또는 다른 모듈을 사용하거나 경우에 따라 두 모듈을 모두 사용할 수 있습니다(예: 반응형 WebClient가 포함된 Spring MVC 컨트롤러)."라고 써져 있습니다. 실제로 spring-boot-starter-web,.. 2023. 7. 13.
[Spring] RestTemplate Deprecated의 진실 Spring framework에서 제공하는 Http Client API로 RestTemplate이 있습니다. 그런데 인터넷에서 RestTemplate이 Deprecated 된다는 얘기를 종종 볼 수 있습니다. 하지만 최근 문서에서는 WebClient 사용을 권고하는 말 뿐, RestTemplate을 Deprecated 한다는 말은 없습니다. 그럼 왜 RestTemplate이 Deprecated된다는 소문이 퍼진 걸까요? 확인해 보니 spring 5.2.1.RELEASE 버전 문서에 RestTemplate가 Deprecated 될 예정이라고 써져 있었습니다. 이 문서가 소문의 근원지가 아닐까 싶습니다. 그런데 spring github issue에도 다음과 같은 글이 올라와있습니다. "향후 사용 중단 가능성.. 2023. 7. 13.
[Spring Boot] RedisCommandExecutionException: ERR unknown command 'CONFIG', with args beginning with: 'GET' 'notify-keyspace-events' io.lettuce.core.RedisCommandExecutionException: ERR unknown command 'CONFIG', with args beginning with: 'GET' 'notify-keyspace-events' ... org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR unknown command 'CONFIG', with args beginning with: 'GET' 'notify-keyspace-events' ... org.springframework.beans.f.. 2023. 5. 19.
[Spring Security] DaoAuthenticationProvider org.springframework.security.authentication.dao.DaoAuthenticationProvider DaoAuthenticationProvider는 UserDetailsService 및 PasswordEncoder를 사용하여 사용자 아이디와 암호를 인증하는 AuthenticationProvider 구현입니다. The authentication Filter는 ProviderManager에 의해 구현되는 AuthenticationManager에 UsernamePasswordAuthenticationToken을 전달합니다. ProviderManager는 DaoAuthenticationProvider 타입의 AuthenticationProvider를 사용하도록 구성됩니다. Dao.. 2023. 5. 9.
[Spring] webSocket 보호되어 있는 글 입니다. 2023. 4. 5.
728x90
반응형