
Spring Boot Apps 을 실행했더니 아래와 같은 에러가 나타났다.
Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.io.FileNotFoundException: class path resource [sqlmap/sql-mapper-config.xml] cannot be opened because it does not exist

해당 구문은 application.properties 에 선언한 mybatis.config-location 의 sql-mapper-config.xml ( = mybatis-config.xml ) 을 찾지 못해서 발견된 현상이다.
MyBatis 란
- Java 에서 database 를 쉽게 다룰 수 있도록 도와주는 오픈소스 ORM (Object-Relational mapping) framework
- Database 쿼리와 프로그래밍 언어 코드를 분리 -> 유지보수성과 생산성 향상
- 동적 쿼리 작성 가능 =
<if>, <choose>, <when>, <otherwise>, <foreach>사용 가능
mybatis-config.xml
- MyBatis에서 SQL 쿼리와 Java 객체를 매핑하고, 데이터베이스 연동 및 매퍼 파일 등록을 위한 설정 파일
mybatis.config-location 이란
- MyBatis의 설정 파일(mybatis-config.xml) 경로를 지정하는 속성

mybatis.config-location 에 지정해둔 위치에 해당 sql-mapper-config.xml ( = mybatis-config.xml ) 을 지정해둔다.
sql-mapper-config.xml ( = mybatis-config.xml ) 선언 요소
- XML
<?xml version="1.0" encoding="UTF-8"?>- DTD (Document Type Definition)
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">- < configuration >
root element- < typeAliases >
MyBatis에서 사용할 Java 클래스의 별칭(alias)을 설정하는 태그


저장 후 project 를 재실행하면 문제가 해결된 것을 확인할 수 있다.