batis-Context.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. xmlns:tx="http://www.springframework.org/schema/tx"
  6. xmlns:aop="http://www.springframework.org/schema/aop"
  7. xsi:schemaLocation="
  8. http://www.springframework.org/schema/beans
  9. http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  10. http://www.springframework.org/schema/context
  11. http://www.springframework.org/schema/context/spring-context-3.0.xsd
  12. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
  13. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
  14. <context:property-placeholder location="WEB-INF/config/config.properties"/>
  15. <!--
  16. <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
  17. <property name="driverClassName"><value>${config.jdbc.driverClassName}</value></property>
  18. <property name="url"><value>${config.jdbc.url}</value></property>
  19. <property name="username"><value>${config.jdbc.username}</value></property>
  20. <property name="password"><value>${config.jdbc.password}</value></property>
  21. <property name="maxActive"><value>${config.jdbc.maxActive}</value></property>
  22. <property name="maxIdle"><value>${config.jdbc.maxIdle}</value></property>
  23. <property name="maxWait"><value>${config.jdbc.maxWait}</value></property>
  24. <property name="connectionProperties" value="oracle.jdbc.V8Compatible=true;"/>
  25. <property name="testOnBorrow" value="true"/>
  26. <property name="testWhileIdle" value="true"/>
  27. </bean>
  28. -->
  29. <!--
  30. 通常来说,只需要修改initialSize、minIdle、maxActive。
  31. 如果用Oracle,则把poolPreparedStatements配置为true,mysql可以配置为false。分库分表较多的数据库,建议配置为false。
  32. -->
  33. <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
  34. init-method="init" destroy-method="close">
  35. <!-- 基本属性 url、user、password -->
  36. <property name="url" value="${config.jdbc.url}" />
  37. <property name="username" value="${config.jdbc.username}" />
  38. <property name="password" value="${config.jdbc.password}" />
  39. <!-- 配置初始化大小、最小、最大 -->
  40. <property name="initialSize" value="${config.jdbc.initialSize}" />
  41. <property name="minIdle" value="${config.jdbc.minIdle}" />
  42. <property name="maxActive" value="${config.jdbc.maxActive}" />
  43. <!-- 配置获取连接等待超时的时间 -->
  44. <property name="maxWait" value="${config.jdbc.maxWait}" />
  45. <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
  46. <property name="timeBetweenEvictionRunsMillis" value="60000" />
  47. <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
  48. <property name="minEvictableIdleTimeMillis" value="300000" />
  49. <!--
  50. <property name="validationQuery" value="SELECT 'x'" />
  51. -->
  52. <property name="validationQuery" value="select 1 from dual" />
  53. <property name="testWhileIdle" value="true" />
  54. <property name="testOnBorrow" value="false" />
  55. <property name="testOnReturn" value="false" />
  56. <!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
  57. <property name="poolPreparedStatements" value="true" />
  58. <property name="maxPoolPreparedStatementPerConnectionSize"
  59. value="20" />
  60. <!-- 配置监控统计拦截的filters -->
  61. <property name="filters" value="stat" />
  62. </bean>
  63. <!--
  64. <bean id="jdbcTemplate"
  65. class="org.springframework.jdbc.core.JdbcTemplate">
  66. <property name="dataSource" ref="dataSource" />
  67. </bean>
  68. <bean id="namedParameterJdbcTemplate"
  69. class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
  70. <constructor-arg name="dataSource" ref="dataSource"></constructor-arg>
  71. </bean>
  72. -->
  73. <bean id="transactionManager"
  74. class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  75. <property name="dataSource">
  76. <ref bean="dataSource" />
  77. </property>
  78. </bean>
  79. <tx:annotation-driven transaction-manager="transactionManager"/>
  80. <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  81. <property name="dataSource" ref="dataSource" />
  82. <!--<property name="mapperLocations"></property>-->
  83. <property name="mapperLocations" value="classpath*:com/cxfws/**/xml/*Mapper.xml" />
  84. <property name="typeAliasesPackage" value="org.sjns.bean" />
  85. </bean>
  86. <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
  87. <property name="basePackage" value="com.cxfws.**.mapper" />
  88. <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
  89. </bean>
  90. <!-- 定时器配置 -->
  91. <bean id="schedule" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
  92. <property name="triggers">
  93. <list>
  94. <ref bean ="FZDtSynchTb"/>
  95. </list>
  96. </property>
  97. </bean>
  98. <!-- 许可证附证数据交换 定时器 -->
  99. <bean id="FZDtSynchTb" class="org.springframework.scheduling.quartz.CronTriggerBean">
  100. <property name="jobDetail" ref="FZDtSynchTbSxl" />
  101. <property name="cronExpression" value="0 0/2 * * * ?" />
  102. <!-- <property name="cronExpression" value="30 14 10 * * ? *" />-->
  103. </bean>
  104. <!-- 许可证附证定时器对应路径和方法 -->
  105. <bean id="FZDtSynchTbSxl" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
  106. <property name="targetObject" ref="FZSynchTbSxl" />
  107. <property name="targetMethod" value="webserviceCall" />
  108. <property name="concurrent" value="false"/>
  109. </bean>
  110. <bean id="FZSynchTbSxl" class="com.cxfws.demo.control.DemoController" scope="prototype">
  111. </bean>
  112. </beans>