MyBatis 연결 테스트
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(
locations= {"file:src/main/webapp/WEB-INF/spring/**/root-context.xml"})
public class MYSQLTest {
@Inject
private SqlSessionFactory sqlFactory;
@Test
public void test() {
System.out.println(sqlFactory);
}
@Test
public void testSession() throws Exception{
try(SqlSession session=sqlFactory.openSession()) {
System.out.println(session);
} catch (Exception e) {
e.printStackTrace();
}
}
}
'springframework' 카테고리의 다른 글
| 스프링 스케쥴러를 통한 [cpu,memory] 배치 시스템 만들기 (0) | 2020.06.02 |
|---|---|
| 스프링 mvc에서 주로 사용되는 어노테이션 종류 (0) | 2019.01.17 |
| spring + mybatis 환경설정 -1 (0) | 2019.01.17 |
| jUnit -test 환경설정 (0) | 2019.01.17 |
| MYSQL 라이브러리 -maven (0) | 2019.01.17 |