250x250
Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- spring
- MSSQL
- jpa
- Core Java
- git
- Tomcat
- myBatis
- IntelliJ
- Spring Boot
- Thymeleaf
- JavaScript
- STS
- Eclipse
- Source
- 오픈소스
- MySQL
- 문서
- 설정
- Open Source
- AJAX
- Python
- ubuntu
- SpringBoot
- JDBC
- Docker
- error
- PostgreSQL
- maven
- Exception
- oracle
Archives
- Today
- Total
헤르메스 LIFE
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true 본문
Exception
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
헤르메스의날개 2022. 2. 20. 23:19728x90
1. STS 버전 : 4.13.1
2. JDK 버전 : OpenJDK 11.0.14_9_x64
3. Tomcat 버전 : 9.0.56
4. Maven 버전 : 3.8.4
5. Spring 버전 : Spring Boot 2.6.3
6. Database : Docker 에 DB 설치
- primary - PostgreSQL 13.3
- secondary - MySQL DB 8.0.28
오류내용
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'productRepository', defined in com.study.springboot.product.repository.ProductRepository defined in @EnableJpaRepositories declared on SecondaryDatasourceConfiguration, could not be registered. A bean with that name has already been defined in com.study.springboot.product.repository.ProductRepository defined in @EnableJpaRepositories declared on PrimaryDatasourceConfig and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
해결
SpringBoot 2.1 부터 overriding 옵션이 false 되었다고 합니다.
Bean Overriding을 활성화 하기 위해 아래 옵션을 추가 하면 해결된다고 합니다.
spring:
main:
allow-bean-definition-overriding: true
spring:
main:
allow-bean-definition-overriding: true
h2:
console:
enabled: true
path: /h2-console
jpa:
generate-ddl: true
hibernate:
ddl-auto: create
show-sql: false
properties:
hibernatte:
format_sql: true
profiles:
active: local
참고
https://www.baeldung.com/spring-boot-bean-definition-override-exception
https://n1tjrgns.tistory.com/172
728x90