MyBatisTest
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | package kr.co.silver.board; import javax.inject.Inject; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "file:src/main/webapp/WEB-INF/spring/**/root-context.xml" }) public class MyBatisTest { @Inject private SqlSessionFactory sqlFactory; @Test public void testFactory() throws Exception { System.out.println(sqlFactory); } @Test public void testSession() throws Exception { try (SqlSession session = sqlFactory.openSession()) { System.out.println(session); } catch (Exception e) { e.printStackTrace(); } } } | cs |
'TIP > SPRING' 카테고리의 다른 글
controller (0) | 2018.10.10 |
---|---|
web.xml(3.0)한글 처리 포함 (0) | 2018.10.10 |
mysql db연결 테스트 (0) | 2018.10.10 |
pom.xml 최종 (0) | 2018.10.10 |
mapper.xml (0) | 2018.10.10 |