[에러해결]Unsatisfied dependency expressed through field 'mapper'
2022. 12. 13. 15:33ㆍ에러해결
에러내용 : Unsatisfied dependency expressed through field 'mapper' ~
1. TestMapper.java 파일의 @Mapper 를 -> @Mapper("mapper") 로 수정!
2. TestServiceImpl 파일의 @Autowired 를 -> @Resource(name = "mapper") 로 수정하고 import !
3. 마지막으로 context-mapper.xml에서 원래있던 sqlSession <bean> 부분은 모조리 주석처리하고, 원래있던 sqlSessionFactory <bean> 의 이름은 sqlSession 으로 변경함.
+) 공식문서를 보고 20번째라인의 <property name="basePackage" value="egovframework" /> 부분의 value="egovframework" 를 value="egovframework.rte.**.mapper" 로 바꿔야하나 고민했지만 수정하지 않아도 에러는 발생하지 않았음.
참고한 공식문서 : https://www.egovframe.go.kr/wiki/doku.php?id=egovframework:rte2:psl:dataaccess:mybatisguide
egovframework:rte2:psl:dataaccess:mybatisguide [eGovFrame]
표준프레임워크 dataaccess artifact version을 다음과 같이 2.7.0으로 변경한다. egovframework.rte egovframework.rte.psl.dataaccess 2.7.0 Spring XML 설정 파일 상(ex: context-mapper.xml)에 다음과 같은 sqlSession bean 추가한다.
www.egovframe.go.kr
특히 위 링크의 3.2 Mapper interface 사용 방식 참고함!
참고한 문서 : https://limreus.tistory.com/3
[BE/Spring] @Repository 와 @Mapper 비교하기
2021.03.12 2일차 입사 5일차. 회사에서 이미 운영중인 스프링 프레임워크 기반 장비/자재 관리프로그램으로 기본소양 테스트를 진행했다. 스프링 프로젝트를 다루는 데는 자신있었지만 생각지도
limreus.tistory.com