applicationContext.xml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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:context="http://www.springframework.org/schema/context"
  5. xsi:schemaLocation="http://www.springframework.org/schema/beans
  6. http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
  7. http://www.springframework.org/schema/context
  8. http://www.springframework.org/schema/context/spring-context.xsd">
  9. <context:component-scan base-package="service"/><!-- 扫描service包 -->
  10. <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  11. <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
  12. <property name="url" value="jdbc:mysql://localhost/employee?useUnicode=true&amp;characterEncoding=UTF-8"/>
  13. <property name="username" value="root"/>
  14. <property name="password" value="1388023"/>
  15. </bean>
  16. <!--
  17. <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  18. <property name="dataSource" ref="dataSource"></property>
  19. <property name="configLocation" value="classpath:mybatis-config.xml"></property>
  20. </bean>
  21. -->
  22. <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
  23. <property name="basePackage" value="dao"/>
  24. </bean>
  25. <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  26. <property name="dataSource" ref="dataSource"/>
  27. <property name="mapperLocations" value="classpath*:dao/*Mapper.xml"></property>
  28. <property name="plugins">
  29. <array>
  30. <bean class="com.github.pagehelper.PageInterceptor">
  31. <property name="properties">
  32. <value>
  33. pageSizeZero=ture
  34. reasonable=true
  35. </value>
  36. </property>
  37. </bean>
  38. </array>
  39. </property>
  40. </bean>
  41. </beans>