@Mapper 설정 에러
- 작성자 :
- k*h
- 작성일 :
- 2023-11-22 13:14:46
- 조회수 :
- 640
- 구분 :
- 개발환경 / 4.1
- 진행상태 :
- 완료
Q
안녕하세요? DB 설정중 에러를 만나 문의를 드리게 되었습니다.
현재 설정을하여 테스트 중
Error creating bean with name 'sqlSession' defined in class path resource [egovframework/com/config/EgovConfigAppMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'dataSource' is required
에러를 만나 DB 쿼리문 작성이 불가능 합니다.
DAO를 생성하여 extends EgovAbstractMapper를 사용할 경우
쿼리문 작성 mapper에 있는 쿼리문 실행 테스트 성공 하였습니다.
@Mapper interface생성하여 impl 서비스에서 구현할 경우 해당 에러가 발생합니다.
DAO에서 테스트를 성공하여 DB 커넥션 설정은 완료 되었다고 생각합니다.
하나 걸리는게 있다면 mapperConfigurer Bean을 설정해 줘야 하는데 JAVA 코드를 통하여 등록하였습니다.
----------------------------------------------------------------- -----------------------------------------------
import org.egovframe.rte.psl.dataaccess.mapper.MapperConfigurer;
@Bean
MapperConfigurer mapperConfigurer(DataSource dataSource) {
MapperConfigurer mapperConfigurer = new MapperConfigurer();
mapperConfigurer.setBasePackage("egovframework.com.mapper");
return mapperConfigurer;
}
----------------------------------------------------------------- -------------------------------------------------------
----------------------------------------------------------------- mapper interface 위치
package egovframework.com.mapper;
import org.apache.ibatis.annotations.Param;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
@Mapper("userMapper")
public interface UserMappers {
public String findByUser(@Param("userid") String userid);
}
------------------------------------------------------------------------------------------------------------------------------
해당 설정을 통하여 객체를 등록해주었습니다.
추가로 궁금한 것은 BasePackage의 위치가 @Mapper의 위치가 맞는지 궁금합니다.
해당 내용들 확인 부탁드립니다.
감사합니다.
현재 설정을하여 테스트 중
Error creating bean with name 'sqlSession' defined in class path resource [egovframework/com/config/EgovConfigAppMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'dataSource' is required
에러를 만나 DB 쿼리문 작성이 불가능 합니다.
DAO를 생성하여 extends EgovAbstractMapper를 사용할 경우
쿼리문 작성 mapper에 있는 쿼리문 실행 테스트 성공 하였습니다.
@Mapper interface생성하여 impl 서비스에서 구현할 경우 해당 에러가 발생합니다.
DAO에서 테스트를 성공하여 DB 커넥션 설정은 완료 되었다고 생각합니다.
하나 걸리는게 있다면 mapperConfigurer Bean을 설정해 줘야 하는데 JAVA 코드를 통하여 등록하였습니다.
----------------------------------------------------------------- -----------------------------------------------
import org.egovframe.rte.psl.dataaccess.mapper.MapperConfigurer;
@Bean
MapperConfigurer mapperConfigurer(DataSource dataSource) {
MapperConfigurer mapperConfigurer = new MapperConfigurer();
mapperConfigurer.setBasePackage("egovframework.com.mapper");
return mapperConfigurer;
}
----------------------------------------------------------------- -------------------------------------------------------
----------------------------------------------------------------- mapper interface 위치
package egovframework.com.mapper;
import org.apache.ibatis.annotations.Param;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
@Mapper("userMapper")
public interface UserMappers {
public String findByUser(@Param("userid") String userid);
}
------------------------------------------------------------------------------------------------------------------------------
해당 설정을 통하여 객체를 등록해주었습니다.
추가로 궁금한 것은 BasePackage의 위치가 @Mapper의 위치가 맞는지 궁금합니다.
해당 내용들 확인 부탁드립니다.
감사합니다.
환경정보
-
- OS 정보 : windows 10
- 표준프레임워크 버전 : egov boot 4.1
- JDK(JRE) 정보 : 11
- WAS 정보 : 내장
- DB 정보 : postgres 16
- 기타 환경 정보 :
A
안녕하세요.
표준프레임워크센터입니다.
질문에 첨부하신 내용으로는 EgovConfigAppMapper 클래스 설정에
DataSource Bean이 전달되지 않은 것으로 보입니다.
DataSource 설정 부분과 EgovConfigAppMapper 클래스 설정 부분을
확인해보시기 바랍니다.
감사합니다.
표준프레임워크센터입니다.
질문에 첨부하신 내용으로는 EgovConfigAppMapper 클래스 설정에
DataSource Bean이 전달되지 않은 것으로 보입니다.
DataSource 설정 부분과 EgovConfigAppMapper 클래스 설정 부분을
확인해보시기 바랍니다.
감사합니다.