applicationContext-plugin.xml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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:cache="http://www.springframework.org/schema/cache"
  5. xsi:schemaLocation="
  6. http://www.springframework.org/schema/beans
  7. http://www.springframework.org/schema/beans/spring-beans.xsd
  8. http://www.springframework.org/schema/cache
  9. http://www.springframework.org/schema/cache/spring-cache.xsd">
  10. <cache:annotation-driven cache-manager="cacheManager" />
  11. <!--spring 线程池-->
  12. <bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
  13. <!-- 线程池维护线程的最少数量 -->
  14. <property name="corePoolSize" value="8" />
  15. <!-- 允许的空闲时间 -->
  16. <property name="keepAliveSeconds" value="200" />
  17. <!-- 线程池维护线程的最大数量 -->
  18. <property name="maxPoolSize" value="32" />
  19. <!-- 缓存队列 -->
  20. <property name="queueCapacity" value="32" />
  21. <!-- 对拒绝task的处理策略 -->
  22. <property name="rejectedExecutionHandler">
  23. <bean class="java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy"/>
  24. </property>
  25. </bean>
  26. <bean id="batchExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
  27. <!-- 线程池维护线程的最少数量 -->
  28. <property name="corePoolSize" value="2" />
  29. <!-- 允许的空闲时间 -->
  30. <property name="keepAliveSeconds" value="200" />
  31. <!-- 线程池维护线程的最大数量 -->
  32. <property name="maxPoolSize" value="4" />
  33. <!-- 缓存队列 -->
  34. <property name="queueCapacity" value="4" />
  35. <!-- 对拒绝task的处理策略 -->
  36. <property name="rejectedExecutionHandler">
  37. <bean class="java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy"/>
  38. </property>
  39. </bean>
  40. </beans>