<xsd:element name="executor"> in spring-task-4.3.xsd can set the id, pool-size, queue-capacity, keep-alive, and rejection-policy attributes of the ThreadPoolTaskExecutor, but it cannot set the allowCoreThreadTimeOut attribute.
What is the reason for this design?
So the only way to use @Async annotation is define a Config class with @Configuration and @EnableAsync annotation when I just wanna set the ThreadPoolTaskExecutor's allowCoreThreadTimeOut attribute to true?
Comment From: sbrannen
I've edited your comment to improve the formatting. You might want to check out this Mastering Markdown guide for future reference.
Comment From: sbrannen
Although ThreadPoolTaskExecutor has an allowCoreThreadTimeOut property, the TaskExecutorFactoryBean created behind the scenes by the <task> namespace does not have such a property. Consequently, the <task:executor> namespace element does not expose that property.
As for why this is the case, I can only assume that it was an oversight.
In any case, if you want to use only XML configuration, you should be able to configure an explicit <bean> for a ThreadPoolTaskExecutor with the allowCoreThreadTimeOut property set to true. You would then use that instead of the <task:executor> namespace element.
Does that suit your needs?
Comment From: sbrannen
Since the <task> XML namespace is no longer under active development, I am closing this issue.
If the <task:executor> namespace element does not suit your needs, feel free to declare and configure your own ThreadPoolTaskExecutor bean as previously suggested.