JSP

STS오류 : Impl required a bean of type 'Mapper' that could not be found.

모르는 개발자 2023. 7. 28. 16:37

 

오류 발생!

STS(이클립스) 오류화면

2023-07-28 13:46:34.574 ERROR 17952 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 

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

Description:

Field businessTripMapper in com.xxx.businessTrip.service.impl.BusinessTripServiceImpl required a bean of type 'com.xxx.businessTrip.mapper.BusinessTripMapper' that could not be found.

The injection point has the following annotations:
	- @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'com.xxx.businessTrip.mapper.BusinessTripMapper' in your configuration.
Description: Parameter 0 of method setBusinessTripMapper in com.xxx.businessTrip.service.impl.BusinessTripServiceImpl required a bean of type 'com.xxx.businessTrip.mapper.BusinessTripMapper' that could not be found. The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true) Action: Consider defining a bean of type 'com.xxx.businessTrip.mapper.BusinessTripMapper' in your configuration.

 

 

해결 방법

프로젝트명\src\main\java\com\xxx\config\DatabaseConfigMaria.java

@Configuration
@MapperScan(value = { "com.xxx.xxxx.mapper"
		}
        , sqlSessionFactoryRef = "sqlStssionFactoryMaria")
public class DatabaseConfigMaria {

을 변경해주었다.

 

@Configuration
@MapperScan(value = { "com.xxx.*.mapper"
		}
        , sqlSessionFactoryRef = "sqlStssionFactoryMaria")
public class DatabaseConfigMaria {

 

실행이 잘 된다.