refactor: Mapper 스캔 설정 분리 (API vs 일반 프로젝트)
Mapper 중복 스캔 경고 해결 및 용도별 명확한 분리 ## 문제 - DatabaseConfig에서 중복 패턴으로 Mapper 스캔 - "Bean already defined with the same name!" 경고 발생 - go.kr.project.**.mapper가 api.internal.mapper 포함하여 중복 ## 해결 - DatabaseConfig → ApiMapperConfig로 변경 (API 전용) - ProjectMapperConfig 신규 생성 (일반 프로젝트용) ## 변경사항 - ApiMapperConfig: go.kr.project.api.internal.mapper만 스캔 - ProjectMapperConfig: 일반 프로젝트 및 egovframework mapper 스캔 - carInspectionPenalty.**.mapper - common.mapper - login.mapper - system.**.mapper - egovframework.**.mapper ## 최종 구조 - API 전용: ApiMapperConfig - 일반 프로젝트: ProjectMapperConfig - 중복 없이 명확하게 분리 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>internalApi
parent
8757eb9e95
commit
5b229d7f80
@ -0,0 +1,29 @@
|
||||
package go.kr.project.config;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 프로젝트 공통 MyBatis Mapper 스캔 설정
|
||||
*
|
||||
* <p>일반 프로젝트 모듈의 Mapper 인터페이스를 스캔합니다.</p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>DataSource: egovframework 기본 설정 사용 (DataSourceProxyConfig)</li>
|
||||
* <li>TransactionManager: egovframework 기본 설정 사용 (EgovConfigTransaction.txManager)</li>
|
||||
* <li>SqlSessionFactory: MyBatis Spring Boot Starter가 자동 생성</li>
|
||||
* <li>MapperScan: 일반 프로젝트 및 egovframework의 Mapper 스캔</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>API 전용 Mapper는 ApiMapperConfig에서 별도로 스캔됩니다.</p>
|
||||
*/
|
||||
@Configuration
|
||||
@MapperScan(basePackages = {
|
||||
"go.kr.project.carInspectionPenalty.**.mapper",
|
||||
"go.kr.project.common.mapper",
|
||||
"go.kr.project.login.mapper",
|
||||
"go.kr.project.system.**.mapper",
|
||||
"egovframework.**.mapper"
|
||||
})
|
||||
public class ProjectMapperConfig {
|
||||
}
|
||||
Loading…
Reference in New Issue