
다른 프로젝트에서는 AutoCloseable이 잘 사용되었었는데, 새로운 프로젝트를 만드니
"The resource type SqlSession does not implement java.lang.AutoCloseable"
이런 에러가 떴다.
한참을 검색하여 이유를 알아냈다.
Mybatis 3.2버전부터 try-with-resources를 사용할 수 있는데,
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.1.0</version>
</dependency>
나 같은 경우는 pom.xml에 3.1.0버전이 주입되어 있었다.
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.5</version>
</dependency>
그래서 mybatis-3.4.5버전으로 수정을 해주었다.
