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

Document that @ConditionalOnClass should not be used directly on methods #15578

Closed
snicoll opened this issue Dec 29, 2018 · 2 comments
Closed
Assignees
Labels
type: documentation A documentation update
Milestone

Comments

@snicoll
Copy link
Member

snicoll commented Dec 29, 2018

The condition can't be put in places where the JVM may have loaded the class and look at method definitions.

A typical use case is a @Bean method that returns something and that something may not be on the classpath. Using the condition on the method will be useless as the JVM will load the class before the condition kicks in.

It would be nice to update both the ref guide and the javadoc.

@snicoll snicoll added the type: documentation A documentation update label Dec 29, 2018
@snicoll snicoll added this to the 2.0.x milestone Dec 29, 2018
@snicoll snicoll self-assigned this Dec 31, 2018
@snicoll snicoll modified the milestones: 2.0.x, 2.0.8 Dec 31, 2018
@bondolo
Copy link

bondolo commented Aug 24, 2022

The documentation update wasn't nearly specific enough to be useful. This is still a painful problem to discover and diagnose. Can a clarification of "Extra care" be provided similar to the solution described in the doc?

@philwebb
Copy link
Member

@bondolo I've opened #32166 and pushed this update. Feel free to comment on #32166 if you think further updates are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

3 participants