mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-05 16:59:28 +00:00
Merge pull request #50419 from codingkiddo
Closes gh-50419 * pr/50419: Polish code to use instanceof pattern matching in conditions
This commit is contained in:
+2
-2
@@ -165,8 +165,8 @@ public final class ConditionEvaluationReport {
|
||||
* @return the {@link ConditionEvaluationReport} or {@code null}
|
||||
*/
|
||||
public static ConditionEvaluationReport find(BeanFactory beanFactory) {
|
||||
if (beanFactory instanceof ConfigurableListableBeanFactory) {
|
||||
return ConditionEvaluationReport.get((ConfigurableListableBeanFactory) beanFactory);
|
||||
if (beanFactory instanceof ConfigurableListableBeanFactory configurableListableBeanFactory) {
|
||||
return ConditionEvaluationReport.get(configurableListableBeanFactory);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
+2
-2
@@ -659,8 +659,8 @@ class OnBeanCondition extends FilteringSpringBootCondition implements Configurat
|
||||
}
|
||||
|
||||
private Set<BeanType> deducedBeanType(ConditionContext context, AnnotatedTypeMetadata metadata) {
|
||||
if (metadata instanceof MethodMetadata && metadata.isAnnotated(Bean.class.getName())) {
|
||||
return deducedBeanTypeForBeanMethod(context, (MethodMetadata) metadata);
|
||||
if (metadata instanceof MethodMetadata methodMetadata && metadata.isAnnotated(Bean.class.getName())) {
|
||||
return deducedBeanTypeForBeanMethod(context, methodMetadata);
|
||||
}
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user