[Spring Boot] Bean 중복 등록 에러 해결 방법

Lundy·2023년 4월 12일
0

Spring Boot

목록 보기
4/6
post-thumbnail

🚨 에러 내용

***************************
APPLICATION FAILED TO START
***************************

Description:

The bean 'memberService', defined in class path resource [(경로)/DependencyConfig.class], could not be registered. A bean with that name has already been defined in file [(경로)/member/MemberService.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

스프링 부트 실행 시 위와 같은 내용의 에러가 발생했다.

이는 스프링 부트 버전 2.1 이상부터 오버라이딩 기능을 멈추도록 변경되어 발생하는 에러이다.

🧩 에러 해결 방법

Action 에 나오는 메시지대로 application.properties 파일에 아래의 설정 코드를 입력하면 오버라이딩 가능하도록 변경할 수 있다.

spring.main.allow-bean-definition-overriding=true

profile
아주 사소하더라도

0개의 댓글

관련 채용 정보