-
[Mybatis] mybatis opening session 에러Web/Servlet && Spring 2019. 8. 31. 20:36
한참을 찾았다... 설마 오타때문일줄은 ㅠㅠ
mybatis-config.xml 파일에서 environment태그의 default값과 environment의 id값을 동일하게 적어줘야 한다.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <!-- typeAliases는 무조건 환경설정보다 상위에 위치해야 한다. --> <typeAliases> <typeAlias type="t_tok03.Student" alias="StudentType"/> </typeAliases> <environments default="development"> <environment id="development"> <transactionManager type="JDBC"/> <dataSource type="POOLED"> <property name="driver" value="com.mysql.cj.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:3306/test?serverTimezone=UTC"/> <property name="username" value="root"/> <property name="password" value="0000"/> </dataSource> </environment> </environments> <mappers> <mapper resource="t_tok03/Student.xml"/> </mappers> </configuration>
반응형'Web > Servlet && Spring' 카테고리의 다른 글
[Spring] MyBatis Spring과 연동하는 방법 (0) 2019.09.02 [Mybatis] 마이마티스 두번째 사용방법 (@어노테이션) (0) 2019.08.31 [Spring] @Transactional사용법 ( 트랜잭션: transaction ) (0) 2019.08.29 [Spring] mysql 에러 (mysql Data truncation: Incorrect string value:) (0) 2019.08.29 [Spring] mysql 연결 에러 해결 (deprecated) (0) 2019.08.29