mybatis
-
[spring boot] mybatis 연동 및 설정Spring/spring boot 및 기타 2021. 6. 23. 17:52
spring boot 에서 mybatis 를 연동하는 법을 해보자 pom.xml org.mybatis.spring.boot mybatis-spring-boot-starter 2.2.0 일단 pom.xml 에 mybatis 라이브러리부터 추가하자. dbms 에 맞는 driver 는 추가됐다고 가정하고 진행한다. 사용버젼 표 아래 표에 맞게 version 명시하면 된다. MyBatis-Spring-Boot-Starter MyBatis-Spring Spring Boot Java 2.2 2.0 (need 2.0.6+ for enable all features) 2.5 or higher 8 or higher 2.1 2.0 (need 2.0.6+ for enable all features) 2.1 - 2.4 8 o..
-
[Spring] Mybatis SqlSessionFactory 란Spring/spring framework 기본 및 이론 2020. 6. 1. 15:14
SqlSessionFactory SqlSessionFactory는 데이터베이스와의 연결과 SQL의 실행에 대한 모든 것을 가진 가장 중요한 객체다. 이 객체가 DataSource를 참조하여 MyBatis와 Mysql 서버를 연동시켜준다. SqlSessionFactory를 생성해주는 SqlSessionFactoryBean 객체를 먼저 설정하여야 한다. root-context.xml cofing MyBatis는 SQL Mapping 프레임워크로 별도의 설정 파일을 가질 수 있다. src/main/resources에 mybatis-config.xml 파일을 추가 Mybatis에 별도의 설정을 주고 싶으면 위의 파일을 이용 root-context.xml의 sqlSessionFactory에 다음과 같이 confi..