Spring-boot: Order TaskExecutionAutoConfiguration before TaskSchedulerAutoConfiguration

Created on 18 Feb 2019  路  9Comments  路  Source: spring-projects/spring-boot

Hi, this is a first-timers-only issue. This means we've worked to make it more legible to folks who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.

If that's you, we're interested in helping you take the first step and can answer questions and help you out as you do. Note that we're especially interested in contributions from people from groups underrepresented in free and open source software!

If you have contributed before, consider leaving this one for someone new, and looking through our general ideal-for-contribution issues. Thanks!

Background

Spring Boot 2.1 has introduced auto-configuration for task execution and scheduling with creation of a ThreadPoolTaskExecutor and ThreadPoolTaskScheduler bean if necessary. Both these classes share a common parent which led to a number of issues in the past.

Problem

ThreadPoolTaskExecutor is conditional on the absence of a java.util.concurrent.Executor. If TaskSchedulingAutoConfiguration runs before TaskExecutionAutoConfiguration, it may create a bean that implements Executor and therefore the task execution auto-configuration will back off unecessary.

Solution

There is no strict ordering between those two auto-configurations and things are working right now because the chosen order is so that TaskExecutionAutoConfiguration runs before TaskSchedulingAutoConfiguration. To make this explicit, we should order them explictly as well. The @AutoConfigureBefore or @AutoConfigureAfter annotation can be used for that purpose. Given that TaskSchedulingAutoConfiguration may be problematic here, it sounds more logical to use @AutoConfigureAfter on it and refer to TaskExecutionAutoConfiguration.

Steps to Fix

  • [x] Claim this issue with a comment below and ask any clarifying questions you need
  • [x] Set up a repository locally following the Contributing Guidelines
  • [x] Try to fix the issue following the steps above
  • [x] Commit your changes and start a pull request.
first-timers-only superseded bug

Most helpful comment

Hi @snicoll , seems this issue is closed. I am eagerly looking for opportunities to contribute to spring and open source projects. In future, how do I find this kind of issues for beginners like me to contribute to ?

@Omkar-Shetkar , you can head over to issues section of this repository and find issues with status first-timers-only to begin with. Remember to claim the issue before anyone else as soon as you decide to work on it.

All 9 comments

Hi @snicoll, I would like to work on this one.

Great! Thank you. Please let us know if you have any questions.

Thanks @snicoll. I'll give it a shot too.

Thank you, @jensonjoseph, but @isank has already claimed this issue. Please keep an eye out for another first-timers-only issue and we鈥檇 be delighted to guide you through the process then.

sure! Thanks again.

Closing in favour of PR #15984

Hi @snicoll , seems this issue is closed. I am eagerly looking for opportunities to contribute to spring and open source projects. In future, how do I find this kind of issues for beginners like me to contribute to ?

Hi @snicoll , seems this issue is closed. I am eagerly looking for opportunities to contribute to spring and open source projects. In future, how do I find this kind of issues for beginners like me to contribute to ?

@Omkar-Shetkar , you can head over to issues section of this repository and find issues with status first-timers-only to begin with. Remember to claim the issue before anyone else as soon as you decide to work on it.

@isank Thanks.

Was this page helpful?
0 / 5 - 0 ratings