Introduce BeanFactoryAnnotationUtils

Commit 096693c46f refactored and
deprecated TransactionAspectUtils, moving its #qualifiedBeanOfType
and related methods into BeanFactoryUtils. This created a package cycle
between beans.factory and beans.factory.annotation due to use of the
beans.factory.annotation.Qualifier annotation in these methods.

This commit breaks the package cycle by introducing
beans.factory.annotation.BeanFactoryAnnotationUtils and moving these
@Qualifier-related methods to it. It is intentionally similar in name
and style to the familiar BeanFactoryUtils class for purposes of
discoverability.

There are no backward-compatibilty concerns associated with this change
as the cycle was introduced, caught and now fixed before a release.

Issue: SPR-6847
This commit is contained in:
Chris Beams
2012-05-25 17:23:01 +03:00
parent 4027b38903
commit a4b00c732b
6 changed files with 153 additions and 115 deletions

View File

@@ -25,7 +25,7 @@ import java.util.concurrent.Executor;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.annotation.BeanFactoryAnnotationUtils;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.core.task.support.TaskExecutorAdapter;
import org.springframework.util.Assert;
@@ -110,7 +110,8 @@ public abstract class AsyncExecutionAspectSupport implements BeanFactoryAware {
Assert.notNull(this.beanFactory,
"BeanFactory must be set on " + this.getClass().getSimpleName() +
" to access qualified executor [" + qualifier + "]");
executor = BeanFactoryUtils.qualifiedBeanOfType(this.beanFactory, Executor.class, qualifier);
executor = BeanFactoryAnnotationUtils.qualifiedBeanOfType(
this.beanFactory, Executor.class, qualifier);
}
if (executor instanceof AsyncTaskExecutor) {