Polishing

This commit is contained in:
Sam Brannen
2022-02-19 14:59:54 +01:00
parent 8c6d59aaaf
commit 6a73d2655f
2 changed files with 11 additions and 11 deletions

View File

@@ -156,7 +156,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
/**
* Determine the specific executor to use when executing the given method.
* Should preferably return an {@link AsyncListenableTaskExecutor} implementation.
* <p>Should preferably return an {@link AsyncListenableTaskExecutor} implementation.
* @return the executor to use (or {@code null}, but just if no default executor is available)
*/
@Nullable
@@ -184,7 +184,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
/**
* Return the qualifier or bean name of the executor to be used when executing the
* given async method, typically specified in the form of an annotation attribute.
* Returning an empty string or {@code null} indicates that no specific executor has
* <p>Returning an empty string or {@code null} indicates that no specific executor has
* been specified and that the {@linkplain #setExecutor(Executor) default executor}
* should be used.
* @param method the method to inspect for executor qualifier metadata
@@ -213,7 +213,7 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
/**
* Retrieve or build a default executor for this advice instance.
* An executor returned from here will be cached for further use.
* <p>An executor returned from here will be cached for further use.
* <p>The default implementation searches for a unique {@link TaskExecutor} bean
* in the context, or for an {@link Executor} bean named "taskExecutor" otherwise.
* If neither of the two is resolvable, this implementation will return {@code null}.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ import org.springframework.util.Assert;
public abstract class BeanFactoryAnnotationUtils {
/**
* Retrieve all bean of type {@code T} from the given {@code BeanFactory} declaring a
* Retrieve all beans of type {@code T} from the given {@code BeanFactory} declaring a
* qualifier (e.g. via {@code <qualifier>} or {@code @Qualifier}) matching the given
* qualifier, or having a bean name matching the given qualifier.
* @param beanFactory the factory to get the target beans from (also searching ancestors)
@@ -90,9 +90,9 @@ public abstract class BeanFactoryAnnotationUtils {
Assert.notNull(beanFactory, "BeanFactory must not be null");
if (beanFactory instanceof ListableBeanFactory) {
if (beanFactory instanceof ListableBeanFactory lbf) {
// Full qualifier matching supported.
return qualifiedBeanOfType((ListableBeanFactory) beanFactory, beanType, qualifier);
return qualifiedBeanOfType(lbf, beanType, qualifier);
}
else if (beanFactory.containsBean(qualifier)) {
// Fallback: target bean at least found by bean name.
@@ -163,8 +163,8 @@ public abstract class BeanFactoryAnnotationUtils {
}
try {
Class<?> beanType = beanFactory.getType(beanName);
if (beanFactory instanceof ConfigurableBeanFactory) {
BeanDefinition bd = ((ConfigurableBeanFactory) beanFactory).getMergedBeanDefinition(beanName);
if (beanFactory instanceof ConfigurableBeanFactory cbf) {
BeanDefinition bd = cbf.getMergedBeanDefinition(beanName);
// Explicit qualifier metadata on bean definition? (typically in XML definition)
if (bd instanceof AbstractBeanDefinition abd) {
AutowireCandidateQualifier candidate = abd.getQualifier(Qualifier.class.getName());
@@ -176,8 +176,8 @@ public abstract class BeanFactoryAnnotationUtils {
}
}
// Corresponding qualifier on factory method? (typically in configuration class)
if (bd instanceof RootBeanDefinition) {
Method factoryMethod = ((RootBeanDefinition) bd).getResolvedFactoryMethod();
if (bd instanceof RootBeanDefinition rbd) {
Method factoryMethod = rbd.getResolvedFactoryMethod();
if (factoryMethod != null) {
Qualifier targetAnnotation = AnnotationUtils.getAnnotation(factoryMethod, Qualifier.class);
if (targetAnnotation != null) {