春タスクのデフォルトはされ、それゆえ、マルチスレッドの並列実行を追加する必要があり、タスクの実行時間が長すぎる、あまりにも多くの定期的なタスクの場合、それは他のタスクの実行頻度に影響を与える可能性があり、シングルスレッドの実行で効率的に作業を減らすことができますインパクトのチャンス。次のように解決策は、構成XMLファイルを変更することです:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task.xsd"
default-autowire="byName" default-lazy-init="false">
<!-- 1.扫描指定的包 -->
<context:component-scan base-package="com.qfx.system.task"/>
<!-- 2.启用定时任务 -->
<!-- <task:annotation-driven /> -->
<task:annotation-driven scheduler="myTask" />
<!-- 3.配置定时任务的线程池 -->
<task:scheduler id="myTask" pool-size="5"/>
</beans>