-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Stop using @ConditionalOnClass on @Bean methods #47429
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
base: 3.4.x
Are you sure you want to change the base?
Conversation
The build failure is not related to these changes
|
b2bff1c
to
4dc204e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the new ArchUnit coverage in ArchitectureCheckTests for the @ConditionalOnClass on @bean methods case.
To guard against regressions from moving the condition to configuration classes, could we add an integration test using ApplicationContextRunner with a FilteredClassLoader that hides the target type and verifies the bean is not created?
Examples here would be:
hide org.springframework.security.authentication.event.AbstractAuthenticationEvent for the authentication listener path in AuditAutoConfiguration,
hide org.apache.catalina.valves.AccessLogValve / io.undertow.Undertow for the servlet management access-log customizers,
(optionally) hide ObjectMapper to confirm the Jackson endpoint config still behaves as expected.
This would complement the buildSrc ArchUnit rule by exercising runtime classpath absence under Boot’s typical testing pattern.
Thanks for the suggestion, @danish-ali, but that's out of scope for this PR. I also don't think it would bring much benefit. |
Signed-off-by: Dmytro Nosan <[email protected]>
Related to #47200