40 lines
1.6 KiB
XML
40 lines
1.6 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
|
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
|
<property name="locations">
|
|
<list>
|
|
<value>classpath:db.properties</value>
|
|
</list>
|
|
</property>
|
|
</bean>
|
|
|
|
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
|
<property name="configLocation" value="classpath:mybatis-config.xml" />
|
|
<property name="dataSource" ref="dataSource" />
|
|
</bean>
|
|
|
|
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
|
|
<property name="driverClassName" value="${db.driver}" />
|
|
<property name="url" value="${db.url}" />
|
|
<property name="username" value="${db.username}" />
|
|
<property name="password" value="${db.password}" />
|
|
</bean>
|
|
|
|
<!-- 配置其他 Bean -->
|
|
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
|
|
<constructor-arg ref="sqlSessionFactory" />
|
|
</bean>
|
|
|
|
<!-- 配置 AdminDao Bean -->
|
|
<bean id="adminDao" class="cyou.chenx221.dao.impl.AdminDaoImpl">
|
|
<constructor-arg ref="sqlSession" />
|
|
</bean>
|
|
|
|
|
|
<!-- 配置 AdminService Bean -->
|
|
<bean id="adminService" class="cyou.chenx221.service.impl.AdminServiceImpl">
|
|
<constructor-arg ref="adminDao" />
|
|
</bean>
|
|
</beans> |