applciation.xml foundation configuration and description

前端之家收集整理的这篇文章主要介绍了applciation.xml foundation configuration and description前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
  3. xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
  4. xmlns:cache="http://www.springframework.org/schema/cache"
  5. xsi:schemaLocation="
  6. http://www.springframework.org/schema/context
  7. http://www.springframework.org/schema/context/spring-context.xsd
  8. http://www.springframework.org/schema/beans
  9. http://www.springframework.org/schema/beans/spring-beans.xsd
  10. http://www.springframework.org/schema/tx
  11. http://www.springframework.org/schema/tx/spring-tx.xsd
  12. http://www.springframework.org/schema/jdbc
  13. http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
  14. http://www.springframework.org/schema/cache
  15. http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
  16. http://www.springframework.org/schema/aop
  17. http://www.springframework.org/schema/aop/spring-aop.xsd
  18. http://www.springframework.org/schema/util
  19. http://www.springframework.org/schema/util/spring-util.xsd">
  20. <!-- 自动扫描web包,将带有注解的类 纳入spring容器管理 -->
  21. <context:component-scan base-package="com.eduoinfo.finances.bank.web"></context:component-scan>
  22. <!-- 引入jdbc配置文件 -->
  23. <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  24. <property name="locations">
  25. <list>
  26. <value>classpath*:jdbc.properties</value>
  27. </list>
  28. </property>
  29. </bean>
  30. <!-- dataSource 配置 -->
  31. <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
  32. <!-- 基本属性 url、user、password -->
  33. <property name="url" value="${jdbc.url}" />
  34. <property name="username" value="${jdbc.username}" />
  35. <property name="password" value="${jdbc.password}" />
  36. <!-- 配置初始化大小、最小、最大 -->
  37. <property name="initialSize" value="1" />
  38. <property name="minIdle" value="1" />
  39. <property name="maxActive" value="20" />
  40. <!-- 配置获取连接等待超时的时间 -->
  41. <property name="maxWait" value="60000" />
  42. <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
  43. <property name="timeBetweenEvictionRunsMillis" value="60000" />
  44. <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
  45. <property name="minEvictableIdleTimeMillis" value="300000" />
  46. <property name="validationQuery" value="SELECT 'x'" />
  47. <property name="testWhileIdle" value="true" />
  48. <property name="testOnBorrow" value="false" />
  49. <property name="testOnReturn" value="false" />
  50. <!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
  51. <property name="poolPreparedStatements" value="false" />
  52. <property name="maxPoolPreparedStatementPerConnectionSize" value="20" />
  53. <!-- 配置监控统计拦截的filters -->
  54. <property name="filters" value="stat" />
  55. </bean>
  56. <!-- mybatis文件配置,扫描所有mapper文件 -->
  57. <bean id="sqlSessionFactory" class="org.mybatis.spring.sqlSessionfactorybean" p:dataSource-ref="dataSource" p:configLocation="classpath:mybatis-config.xml" p:mapperLocations="classpath:com/eduoinfo/finances/bank/web/dao/*.xml" />
  58. <!-- spring与mybatis整合配置,扫描所有dao -->
  59. <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer" p:basePackage="com.eduoinfo.finances.bank.web.dao" p:sqlSessionfactorybeanName="sqlSessionFactory" />
  60. <!-- 对dataSource 数据源进行事务管理 -->
  61. <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" p:dataSource-ref="dataSource" />
  62. <!-- 配置使Spring采用CGLIB代理 -->
  63. <aop:aspectj-autoproxy proxy-target-class="true" />
  64. <!-- 启用对事务注解的支持 -->
  65. <tx:annotation-driven transaction-manager="transactionManager" />
  66. <!-- Cache配置 -->
  67. <cache:annotation-driven cache-manager="cacheManager" />
  68. <bean id="ehCacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerfactorybean" p:configLocation="classpath:ehcache.xml" />
  69. <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" p:cacheManager-ref="ehCacheManagerFactory" />
  70. </beans>

猜你在找的XML相关文章