본문 바로가기

Web/웹 상식

[Spring] Spring 6.0, Spring Boot 3.0으로 마이그레이션 중 발생 가능 이슈

Spring Boot 2.x -> Spring Boot 3.0 버전으로 마이그레이션 중 발생했던 이슈들과 그에 대한 저의 해결 방법을 정리합니다. 여러 라이브러리들이 매우 빠르게 Spring 버전에 맞게 업데이트 중이니 글 작성 이후 시점에는 다른 해결방법이 나올 수 있으니 참고 부탁드립니다.

발생 이슈

○ No qualifying bean of type 'org.springframework.cloud.openfeign.FeignContext' available

참고 : https://github.com/spring-cloud/spring-cloud-openfeign/issues/803
발생 이유 : Spring Cloud OpenFeign의 구 버전은 호환되지 않는 부분이 있음
해결 방법 : 4.0 이상 버전 사용


○ <org.apache.commons.lang> is deprecated

해결 방법 : org.apache.commons.lang3으로 변경

 

○ Spring Cloud Starter Contract Stub Runner 3.* 버전 사용 불가

발생 이유 :  Dependency 내부에서 Deprecated된 springframework.util.SocketUtil 사용 중
해결 방법 :  4.0 이상 버전 사용

○ JPA QueryDSL 사용 시 javax.persistence → jakarta.persistence 호환 문제

발생 이유 : 이클립스 재단으로 이전돼서 javax → jakarta로 네이밍 변경
해결 방법 : javax와 jakarta 버전 classifier로 설정 가능

<dependency>
	<groupId>com.querydsl</groupId>
	<artifactId>querydsl-jpa</artifactId>
	<version>${querydsl.version}</version>
	<classifier>jakarta</classifier>
</dependency>

 

○ org.hibernate.dialect.MySQL5InnoDBDialect (Deprecated) 이슈

해결 방법 :
org.hibernate.dialect.MySQL5InnoDBDialect → org.hibernate.dialect.MySQL57Dialect 변경
hibernate.dialect.storage_engine 설정 → innodb

 

○ The bean could not be injected because it is a JDK dynamic proxy

참고 : https://gmoon92.github.io/spring/aop/2019/04/20/jdk-dynamic-proxy-and-cglib.html
발생 이유 : JDK dynamic proxy의 경우 인터페이스가 아닌 구현체 bean을 주입 및 사용하는 걸 막는 것으로 보임
해결 방법 : 인터페이스 bean을 사용하도록 수정 or CGLib proxy 설정으로 수정

 Spring Cloud Sleuth → Micrometer Tracing으로 변경됨

참고 : https://spring.io/blog/2022/10/12/observability-with-spring-boot-3
Micrometer Tracing docs : https://micrometer.io/docs/tracing
해결 방법 : sleuth 관련 Dependency를 아래 Dependency로 변경

<dependency>
	<groupId>io.micrometer</groupId>
	<artifactId>micrometer-tracing</artifactId>
	<version>1.0.0</version>
<dependency>

 

JPA @Table 사용 시 name에 schema까지 작성하는 것 불가

(추가 설정하면 가능할지도...?)

발생 이유 : JPA 엔티티 작성 시 @Table(name="{Database Schema 명}.{테이블 명}") 으로 작성하면 쿼리에서 {Schema 명}.{Schema 명}.{테이블 명}으로 인식되는 에러 발생

해결 방법 : @Table(name="{테이블 명}", schema="{Schema 명}")으로 분리해서 작성


Attempt to recreate a file for type Qclass 에러 발생

발생 이유 : querydsl 사용 시 build plugin인 apt-maven-plugin과 querydsl-api 5.0.0 버전을 dependency에 설정하면 중복으로 파일이 생성되면서 에러 발생
해결 방법 : apt-maven-plugin이 사용할 목적으로만 dependency를 추가해야 하므로 plugin.dependencies.dependency에 querydsl-api 추가

 

반응형