mybatis-beans.xml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  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" xmlns:mvc="http://www.springframework.org/schema/mvc"
  4. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
  5. <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  6. <property name="dataSource" ref="datasource" />
  7. <property name="mapperLocations" value="classpath*:mybatis/*.xml" />
  8. <property name="configurationProperties">
  9. <props>
  10. <prop key="cacheEnabled">false</prop>
  11. </props>
  12. </property>
  13. <property name="plugins">
  14. <array>
  15. <bean class="com.github.pagehelper.PageInterceptor">
  16. <property name="properties">
  17. <value>helperDialect=mysql</value>
  18. </property>
  19. </bean>
  20. </array>
  21. </property>
  22. </bean>
  23. <bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
  24. <constructor-arg index="0" ref="sqlSessionFactory" />
  25. </bean>
  26. <mvc:cors>
  27. <mvc:mapping path="/**" allowed-origins="*" allow-credentials="true" max-age="1800"
  28. allowed-methods="GET,POST,PUT,DELETE,PATCH,OPTIONS"/>
  29. </mvc:cors>
  30. <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
  31. <property name="basePackage" value="com.demo.wjj.mapper" />
  32. </bean>
  33. </beans>