Commit b846143c authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '2.2.x' into 2.3.x

Closes gh-24004
parents e8204007 d32d65b0
...@@ -7764,6 +7764,10 @@ For this reason, we recommend using only `@ConditionalOnBean` and `@ConditionalO ...@@ -7764,6 +7764,10 @@ For this reason, we recommend using only `@ConditionalOnBean` and `@ConditionalO
NOTE: `@ConditionalOnBean` and `@ConditionalOnMissingBean` do not prevent `@Configuration` classes from being created. NOTE: `@ConditionalOnBean` and `@ConditionalOnMissingBean` do not prevent `@Configuration` classes from being created.
The only difference between using these conditions at the class level and marking each contained `@Bean` method with the annotation is that the former prevents registration of the `@Configuration` class as a bean if the condition does not match. The only difference between using these conditions at the class level and marking each contained `@Bean` method with the annotation is that the former prevents registration of the `@Configuration` class as a bean if the condition does not match.
TIP: When declaring a `@Bean` method, provide as much type information as possible in the method's return type.
For example, if your bean's concrete class implements an interface the bean method's return type should be the concrete class and not the interface.
Providing as much type information as possible in `@Bean` methods is particularly important when using bean conditions as their evaluation can only rely upon to type information that's available in the method signature.
[[boot-features-property-conditions]] [[boot-features-property-conditions]]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment