applicationContext.xml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:p="http://www.springframework.org/schema/p"
  5. xmlns:aop="http://www.springframework.org/schema/aop"
  6. xmlns:mvc="http://www.springframework.org/schema/mvc"
  7. xmlns:context="http://www.springframework.org/schema/context"
  8. xsi:schemaLocation="http://www.springframework.org/schema/beans
  9. http://www.springframework.org/schema/beans/spring-beans.xsd
  10. http://www.springframework.org/schema/mvc
  11. http://www.springframework.org/schema/mvc/spring-mvc.xsd
  12. http://www.springframework.org/schema/context
  13. http://www.springframework.org/schema/context/spring-context.xsd
  14. http://www.springframework.org/schema/aop
  15. http://www.springframework.org/schema/aop/spring-aop-4.3.xsd" >
  16. <!-- 加载配置文件 -->
  17. <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  18. <property name="locations">
  19. <list>
  20. <value>classpath:jdbc.properties</value>
  21. <value>classpath:basicInfo.properties</value>
  22. </list>
  23. </property>
  24. </bean>
  25. <!-- 数据源的配置 -->
  26. <bean id = "dataSource" class="org.apache.commons.dbcp.BasicDataSource">
  27. <property name="driverClassName" value = "${jdbc.driver}"></property>
  28. <property name="url" value = "${jdbc.url}"></property>
  29. <property name="username" value = "${jdbc.username}"></property>
  30. <property name="password" value = "${jdbc.password}"></property>
  31. </bean>
  32. <!-- session工厂 -->
  33. <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  34. <property name="dataSource" ref="dataSource"/>
  35. <property name="typeAliasesPackage" value="com.fuzamei.entity"/>
  36. <property name="mapperLocations" value="classpath:com/fuzamei/mapper/*.xml"/>
  37. <property name="configLocation" value = "classpath:mybatis-config.xml"/>
  38. </bean>
  39. <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
  40. <property name="basePackage" value="com.fuzamei.mapperInterface"/>
  41. </bean>
  42. </beans>