You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
<?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:context= "http://www.springframework.org/schema/context"
xsi:schemaLocation= "http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd" >
<!-- 扫描类包, 将标注Spring注解的类自动转化为Bean, 同时完成Bean的注入 -->
<context:component-scan base-package= "com.library.dao" />
<context:component-scan base-package= "com.library.service" />
<context:property-placeholder location= "classpath*:db.properties" />
<!-- 定义一个使用DBCP实现的数据源 -->
<bean id= "dataSource" class= "org.apache.commons.dbcp.BasicDataSource" >
<property name= "driverClassName" value= "${jdbc.driver}" />
<!-- url -->
<property name= "url" value= "${jdbc.url}" />
<!-- 用户名 -->
<property name= "username" value= "${jdbc.username}" />
<!-- 密码 -->
<property name= "password" value= "${jdbc.password}" />
</bean>
<bean id= "sqlSessionFactory" class= "org.mybatis.spring.SqlSessionFactoryBean" >
<property name= "dataSource" ref= "dataSource" />
<property name= "mapperLocations" value= "classpath:MyBatis/*" />
</bean>
<bean id= "sqlSessionTemplate" class= "org.mybatis.spring.SqlSessionTemplate" >
<constructor-arg index= "0" ref= "sqlSessionFactory" />
</bean>
</beans>