Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TaskLifecycleListener triggers early, and possibly cyclical, bean initialisation when an ApplicationEvent is published #448

Closed
wilkinsona opened this issue Oct 2, 2018 · 1 comment
Assignees
Milestone

Comments

@wilkinsona
Copy link
Contributor

TaskLifecycleListener has quite a broad and deep dependency graph and, due to it being an ApplicationListener<ApplicationEvent>, this entire graph is initialized the first time any ApplicationEvent is published after the listener has been defined. In addition to the dependency cycles described in this Spring Boot issue, triggering early initialisation can also cause more subtle problems. For both reasons it should be avoided.

You can reproduce a failure with Spring Cloud Task 1.2.3 with the following steps:

  1. git checkout v1.2.3.RELEASE
  2. echo SELECT 1 > spring-cloud-task-samples/jpa-sample/src/main/resources/schema.sql
  3. ./mvnw -f spring-cloud-task-samples/jpa-sample clean test
@wilkinsona
Copy link
Contributor Author

Another failure which, I think, is due to early initialisation can be reproduced with the following steps:

  1. git checkout v1.2.3.RELEASE
  2. echo SELECT 1 > spring-cloud-task-samples/timestamp/src/main/resources/schema.sql
  3. ./mvnw -f spring-cloud-task-samples/timestamp clean test

@cppwfs cppwfs self-assigned this Oct 2, 2018
cppwfs added a commit to cppwfs/spring-cloud-task that referenced this issue Oct 2, 2018
…tialisation

Replaced TaskListenerExecutorFactory with TaskListenerExecutorObjectProviderTests.  This delays the need to acquire a bean till it is needed vs at application event time.

resolves spring-cloud#448
cppwfs added a commit to cppwfs/spring-cloud-task that referenced this issue Oct 2, 2018
…tialisation

Replaced TaskListenerExecutorFactory with TaskListenerExecutorObjectProviderTests.  This delays the need to acquire a bean till it is needed vs at application event time.

resolves spring-cloud#448
@cppwfs cppwfs added in pr and removed in progress labels Oct 2, 2018
cppwfs added a commit to cppwfs/spring-cloud-task that referenced this issue Oct 2, 2018
…tialisation

Replaced TaskListenerExecutorFactory with TaskListenerExecutorObjectProviderTests.  This delays the need to acquire a bean till it is needed vs at application event time.

resolves spring-cloud#448
@sabbyanandan sabbyanandan added this to the 2.1.0.M1 milestone Oct 3, 2018
cppwfs added a commit to cppwfs/spring-cloud-task that referenced this issue Oct 23, 2018
…tialisation

Replaced TaskListenerExecutorFactory with TaskListenerExecutorObjectProviderTests.  This delays the need to acquire a bean till it is needed vs at application event time.

resolves spring-cloud#448
cppwfs added a commit to cppwfs/spring-cloud-task that referenced this issue Oct 25, 2018
…tialisation

Replaced TaskListenerExecutorFactory with TaskListenerExecutorObjectProviderTests.  This delays the need to acquire a bean till it is needed vs at application event time.

resolves spring-cloud#448
cppwfs added a commit to cppwfs/spring-cloud-task that referenced this issue Oct 26, 2018
…tialisation

Replaced TaskListenerExecutorFactory with TaskListenerExecutorObjectProviderTests.  This delays the need to acquire a bean till it is needed vs at application event time.

resolves spring-cloud#448
@mminella mminella removed the in pr label Nov 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants