이슈
DatabaseConfig-A
-> @Primary 설정
DatabaseConfig-B
-> @Primary 설정 없음
DatabaseConfig-B 에 설정한 Mapper에서 에러 발생
Invalid bound statement (not found): com.xxx.mapper.xxxMapper.select
원인
@MapperScan의 basePackages 가 중복됐던 것.
해결
DatabaseConfig-A 설정 변경
변경 전
@MapperScan(basePackages="com.my.mapper.*"
변경 후
@MapperScan(basePackages="com.my.mapper.aaa"
각 DB별 MapperScan의 basePackages 를 구체적으로 설정해주니 해결되었다.
참고
이 분은 다른 방법으로 해결하셨으니 참고하시게.
https://okky.kr/questions/867676
OKKY - mybatis 다중 DB 연결시 에러 Invalid bound statement (not found)
안녕하세요?스프링부트 + 마이 바티스로 웹서버를 만들려고 합니다.마이바티스 다중 DB 연결시 에러가 발생하여 여러 검색을 통해 봤지만좀처럼 맞는 답변이 없어서 이렇게 조언을 좀 구하게 되
okky.kr
이분은 오타이셨다네.
https://www.cnblogs.com/aaacarrot/p/17007647.html
【mybatis】 Invalid bound statement (not found): com.xxx.mapper.xxxMapper.selectByxx - aaacarrot - 博客园
背景: 业务功能开发,新增一些查询功能,对应地创建了一个 mapper 接口类,一个 mapper.xml 文件。 这个mapper 的命名是: Rolemapper.xml (盯着它) 什么namespace, 方法名都没有名, 但是在执行方法
www.cnblogs.com
'Spring' 카테고리의 다른 글
[Springboot] SLF4j logback 로그 파일명 동적으로 변경하기 (1) | 2024.05.05 |
---|---|
[JPA] BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource~ (0) | 2023.08.06 |
[Swagger] Springdoc-openapi Cors 에러 해결 방법 (1) | 2023.07.16 |
[Spring] @PostConstruct 사용 후 다른 클래스에서 호출 방법 (0) | 2022.12.20 |
[Spring][Error] Could not bind properties to 'SecurityProperties' (0) | 2022.05.02 |