使用JDBCTemplate实现与Spring结合,方法公用 ——Spring配置(applicationContext.xml)

xiaoxiao2021-02-28  124

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property> <property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:orcl"></property> <property name="password" value="123"></property> <property name="username" value="pro"></property> </bean> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource" ref="dataSource"></property> </bean> <bean id="baseDao" class="org.dao.impl.EmpDaoImpl"> <property name="jdbcTemplate" ref="jdbcTemplate"></property> </bean> </beans>
转载请注明原文地址: https://www.6miu.com/read-21226.html

最新回复(0)