MCPcopy Create free account
hub / github.com/castello/spring_basic / DBConnectionTest3

Class DBConnectionTest3

ch3/DBConnectionTest3.java:17–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15import static org.junit.Assert.*;
16
17@RunWith(SpringJUnit4ClassRunner.class)
18@ContextConfiguration(locations={"file:src/main/webapp/WEB-INF/spring/**/root-context.xml"})
19public class DBConnectionTest3 {
20 @Autowired
21 DataSource ds; // 컨테이너로부터 자동 주입받는다.
22
23 @Test
24 public void jdbcConnectionTest() throws Exception {
25// ApplicationContext ac = new GenericXmlApplicationContext("file:src/main/webapp/WEB-INF/spring/**/root-context.xml");
26// DataSource ds = ac.getBean(DataSource.class);
27
28 Connection conn = ds.getConnection(); // 데이터베이스의 연결을 얻는다.
29
30 System.out.println("conn = " + conn);
31 assertTrue(conn!=null);
32 }
33}
34

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected