기본구조 구현된 스프링 프로젝트
Servlet-context.xml
<!-- template -->
<beans:bean name="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<beans:property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<beans:property name="url"
value="jdbc:oracle:thin:@localhost:1521:orcl" />
<beans:property name="username" value="scott" />
<beans:property name="password" value="tiger" />
</beans:bean>
<beans:bean name="template"
class="org.springframework.jdbc.core.JdbcTemplate">
<beans:property name="dataSource" ref="dataSource" />
</beans:bean>
<!-- END template -->
web.xml
<resource-ref>
<description>Connection</description>
<res-ref-name>jdbc:/OracleDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
pom.xml
<!-- JDBC Template -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
<!-- END JDBC Template -->
'JAVA > Spring 4.0' 카테고리의 다른 글
Spring4.0 Mybatis 프로젝트 기본구조 (0) | 2015.10.01 |
---|---|
Spring4.0 Mybatis (pom.xml) (0) | 2015.10.01 |
Spring4.0 메이븐 프로젝트 구조 (0) | 2015.09.22 |
Spring4.0 resources 경로이용하기 (0) | 2015.09.16 |
Spring4.0 ModelAndView 이용한 전달 (0) | 2015.09.16 |