spring jdbcTemplate 配置

 1 <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
 2         destroy-method="close" abstract="false" lazy-init="default" autowire="default">
 3         <property name="driverClass">
 4             <value>oracle.jdbc.driver.OracleDriver</value>
 5         </property>
 6 
 7         <property name="jdbcUrl"> 
 8             <value>jdbc:oracle:thin:@192.168.31.18:1521:orcl</value>
 9         </property>
10         <property name="user">
11             <value>rensheju</value> 
12         </property>
13         <property name="password">
14             <value>123</value>
15         </property>
16           
17         <property name="maxPoolSize">
18             <value>5</value>
19         </property>
20         <property name="minPoolSize">
21             <value>1</value>
22         </property>
23         <property name="initialPoolSize">
24             <value>1</value> 
25         </property>
26     </bean>
27 
28 
29 
30 
31 
32 <bean id="jdbcTemplate"
33         class="org.springframework.jdbc.core.JdbcTemplate">
34         <property name="dataSource">
35             <ref local="dataSource" />
36         </property>
37     </bean>


@Autowired
public JdbcTemplate jdbcTemplate;



 

posted @ 2018-11-09 14:14  南国的刘新  阅读(360)  评论(0编辑  收藏  举报