zl程序教程

您现在的位置是:首页 >  后端

当前栏目

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

Spring配置方法XML 实现 结合 JdbcTemplate ApplicationContext
2023-09-14 08:57:40 时间
<?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>