spring c3p0数据源配置
1、applicationContext.xml配置
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/> <property name="jdbcUrl" value="jdbc:oracle:thin:@10.111.1.1:1521:orcl"/> <property name="user" value="123"/> <property name="password" value="123"/> </bean>
2、使用:
@Autowired
private ComboPooledDataSource dataSource;