-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
Regression in @Condition exclusion [SPR-12233] #16848
Comments
Christopher Smith commented I'm also seeing this behavior (exceptions on refreshing the context) when JRebel tries to reload under 4.0.7. The underlying regression may actually be in 4.0.7 (perhaps the changes related to #16634?), and 4.1.0 just triggers it earlier. |
Phil Webb commented Thanks for the detailed report and for the sample project. There was very specific set of circumstances needed to trigger the bug. |
Christopher Smith commented I have updated to 4.1.1 and am seeing the same issue. The actual environment in which I'm seeing the behavior is a JRebel context reload after modifying a controller class. The exception is occurring in the actual library I used in the example (the Blitline Java client Spring connector) because an optional environment property is not present, but the DI is trying to instantiate the bean anyway.
|
Phil Webb commented Christopher Smith Are you able to reproduce the issue without JRebel? |
Christopher Smith commented I'm not sure how to. It seems to be related to refreshing the |
Phil Webb commented The context is returned from |
Christopher Smith commented Attempts to call |
Phil Webb commented Christopher Smith Could you please open a new issue for this. It sounds like it's something specific to the way that JRebel is interacting with Spring. |
Christopher Smith opened SPR-12233 and commented
I have a bean that's doing conditional autoconfiguration based on whether a certain property is available in the environment; the actual condition matcher is
The configuration class then creates a bean using an
@Value
injection if that property is present.Spring 4.0.7->4.1.0 introduced a regression wherein the
@Value
is being evaluated even when the@Condition
should not match, causing the context startup to crash. I have debugged, and Spring is in fact running the condition's matcher before proceeding to try (and fail) to extract the property from the environment. I attempted to step through it, but I could not tell whether the environment is erroneously returning true fromcontainsProperty
or the DI container is failing to disable the class when it has a false condition.A simple Spring Boot application demonstrating the behavior is available at the GitHub link. Change the Spring version in the POM to 4.1.0 to demonstrate the bug; the launcher will crash on startup.
Affects: 4.1 GA
Reference URL: https://github.com/chrylis/spring-SPR-12233
Issue Links:
@Bean
methods too early in case of a circular reference@Configuration
imported via@ImportResource
is not processedReferenced from: commits 4c59d85
The text was updated successfully, but these errors were encountered: