-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
Spring Context not loading with lazy-init from version 14.0.1 #511
Comments
It looks like #492 might have to be reverted @NicklasWallgren Not sure why it would suddenly need to use the default constructor when it normally does not seem to. |
@kagkarlsson The My bad - it works fine in our externalized configuration (since it's in a separate configuration class with a no-args constructor). I'll open a PR.
|
…erStarter as static
Ok, thanks, will have a look 👍 |
…er as static (#512) The `DbSchedulerAutoConfiguration#eagerDbSchedulerStarter` must be declared as static to ensure it is available before the `initialization` of `DbSchedulerAutoConfiguration`. Spring Boot will otherwise try to instantiate the `DbSchedulerAutoConfiguration` class using a no-args constructor. > NOTE: Beans of this type will be instantiated very early in the spring application lifecycle so they should generally be declared static and not have any dependencies. https://docs.spring.io/spring-boot/api/java/org/springframework/boot/LazyInitializationExcludeFilter.html#:~:text=NOTE%3A%20Beans%20of%20this%20type%20will%20be%20instantiated%20very%20early%20in%20the%20spring%20application%20lifecycle%20so%20they%20should%20generally%20be%20declared%20static%20and%20not%20have%20any%20dependencies. Example - auto-configuration class with an args-constructor; https://github.com/spring-projects/spring-boot/blob/ef303e74f7b92373e32d1cf95a121b37d377960a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/jmx/JmxEndpointAutoConfiguration.java#L116 Fixes #511 ## Reminders - [ ] Added/ran automated tests - [ ] Update README and/or examples - [X] Ran `mvn spotless:apply` --- cc @kagkarlsson
🎉 This issue has been resolved in |
Expected Behavior
Upgrade to version
14.0.1
is a patch version and does not include breaking changes.Current Behavior
We are running spring boot integration tests with
spring.main.lazy-initialization: true
Context cannot be loaded anymore:
The root cause is this change, to not eagerly load the DbSchedulerStarter:
https://github.com/kagkarlsson/db-scheduler/pull/492/files
For bug reports
Context
The text was updated successfully, but these errors were encountered: