Skip to content

Commit 6a73d26

Browse files
committed
Polishing
1 parent 8c6d59a commit 6a73d26

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionAspectSupport.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public void setBeanFactory(BeanFactory beanFactory) {
156156

157157
/**
158158
* Determine the specific executor to use when executing the given method.
159-
* Should preferably return an {@link AsyncListenableTaskExecutor} implementation.
159+
* <p>Should preferably return an {@link AsyncListenableTaskExecutor} implementation.
160160
* @return the executor to use (or {@code null}, but just if no default executor is available)
161161
*/
162162
@Nullable
@@ -184,7 +184,7 @@ protected AsyncTaskExecutor determineAsyncExecutor(Method method) {
184184
/**
185185
* Return the qualifier or bean name of the executor to be used when executing the
186186
* given async method, typically specified in the form of an annotation attribute.
187-
* Returning an empty string or {@code null} indicates that no specific executor has
187+
* <p>Returning an empty string or {@code null} indicates that no specific executor has
188188
* been specified and that the {@linkplain #setExecutor(Executor) default executor}
189189
* should be used.
190190
* @param method the method to inspect for executor qualifier metadata
@@ -213,7 +213,7 @@ protected Executor findQualifiedExecutor(@Nullable BeanFactory beanFactory, Stri
213213

214214
/**
215215
* Retrieve or build a default executor for this advice instance.
216-
* An executor returned from here will be cached for further use.
216+
* <p>An executor returned from here will be cached for further use.
217217
* <p>The default implementation searches for a unique {@link TaskExecutor} bean
218218
* in the context, or for an {@link Executor} bean named "taskExecutor" otherwise.
219219
* If neither of the two is resolvable, this implementation will return {@code null}.

spring-beans/src/main/java/org/springframework/beans/factory/annotation/BeanFactoryAnnotationUtils.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@
4848
public abstract class BeanFactoryAnnotationUtils {
4949

5050
/**
51-
* Retrieve all bean of type {@code T} from the given {@code BeanFactory} declaring a
51+
* Retrieve all beans of type {@code T} from the given {@code BeanFactory} declaring a
5252
* qualifier (e.g. via {@code <qualifier>} or {@code @Qualifier}) matching the given
5353
* qualifier, or having a bean name matching the given qualifier.
5454
* @param beanFactory the factory to get the target beans from (also searching ancestors)
@@ -90,9 +90,9 @@ public static <T> T qualifiedBeanOfType(BeanFactory beanFactory, Class<T> beanTy
9090

9191
Assert.notNull(beanFactory, "BeanFactory must not be null");
9292

93-
if (beanFactory instanceof ListableBeanFactory) {
93+
if (beanFactory instanceof ListableBeanFactory lbf) {
9494
// Full qualifier matching supported.
95-
return qualifiedBeanOfType((ListableBeanFactory) beanFactory, beanType, qualifier);
95+
return qualifiedBeanOfType(lbf, beanType, qualifier);
9696
}
9797
else if (beanFactory.containsBean(qualifier)) {
9898
// Fallback: target bean at least found by bean name.
@@ -163,8 +163,8 @@ public static boolean isQualifierMatch(
163163
}
164164
try {
165165
Class<?> beanType = beanFactory.getType(beanName);
166-
if (beanFactory instanceof ConfigurableBeanFactory) {
167-
BeanDefinition bd = ((ConfigurableBeanFactory) beanFactory).getMergedBeanDefinition(beanName);
166+
if (beanFactory instanceof ConfigurableBeanFactory cbf) {
167+
BeanDefinition bd = cbf.getMergedBeanDefinition(beanName);
168168
// Explicit qualifier metadata on bean definition? (typically in XML definition)
169169
if (bd instanceof AbstractBeanDefinition abd) {
170170
AutowireCandidateQualifier candidate = abd.getQualifier(Qualifier.class.getName());
@@ -176,8 +176,8 @@ public static boolean isQualifierMatch(
176176
}
177177
}
178178
// Corresponding qualifier on factory method? (typically in configuration class)
179-
if (bd instanceof RootBeanDefinition) {
180-
Method factoryMethod = ((RootBeanDefinition) bd).getResolvedFactoryMethod();
179+
if (bd instanceof RootBeanDefinition rbd) {
180+
Method factoryMethod = rbd.getResolvedFactoryMethod();
181181
if (factoryMethod != null) {
182182
Qualifier targetAnnotation = AnnotationUtils.getAnnotation(factoryMethod, Qualifier.class);
183183
if (targetAnnotation != null) {

0 commit comments

Comments
 (0)