내용 :
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mariadbSqlSessionFactory' defined in class path resource [kr/co/kjcSpring/config/database/MariadbConrig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'mariadbSqlSessionFactory' threw exception; nested exception is java.lang.IllegalArgumentException: Location must not be null
나 같은 경우엔
javaConfig를 만들어서 다중 Datasource를 관리하게끔 했는데
spring boot - applicaion.yml에서
config-location와, mapper-locations를 못찾는 이슈였다.
해결방법 : config-location와, mapper-locations를 configureaion과 동일한 순서로 빼고 인식을 했다.
- 해결전
mybatis:
configuration:
config-location: classpath:sql/config/mybatis-config.xml
mapper-locations: classpath:sql/mappers/mysql/*Mapper.xml,classpath:sql/mappers/oracle/*Mapper.xml,classpath:sql/mappers/mariabdb/*Mapper.xml,classpath:sql/mappers/mysql/*Mapper.xml,classpath:sql/mappers/mongidb/*Mapper.xml,classpath:sql/mappers/postgres/*Mapper.xml
- 해결 후
mybatis:
config-location: classpath:sql/config/mybatis-config.xml
mapper-locations: classpath:sql/mappers/mysql/*Mapper.xml,classpath:sql/mappers/oracle/*Mapper.xml,classpath:sql/mappers/mariabdb/*Mapper.xml,classpath:sql/mappers/mysql/*Mapper.xml,classpath:sql/mappers/mongidb/*Mapper.xml,classpath:sql/mappers/postgres/*Mapper.xml
#mapper-locations: classpath:sql/mappers/*Mapper.xml
# configuration:
# map-underscore-to-camel-case: true
# call-setters-on-nulls: true
'SPRING' 카테고리의 다른 글
spring boot Gradle 버전 이슈 (0) | 2022.12.13 |
---|---|
mybatis-config 설정 오류 (0) | 2022.12.11 |
Spring - @Transactional (0) | 2022.10.11 |
Spring - 동적 Property 가져오기 (0) | 2022.08.17 |
Spring MAVEN 프로젝트 생성 - IntelliJ (초기세팅) (0) | 2022.08.17 |