Consolidate annotation processing constants

Consolidating internal bean name and aspect class name constats within
AnnotationConfigUtils to allow access from both the context.config
and context.annotation packages without creating a relationship between
the two of them (they are unrelated leaf nodes in the packaging
currently).

The .transaction module does not have a similar utils class and already
has a relationship from transaction.config -> transaction.annotation,
so placing the constants in .annotation.TransactionManagementCapability
to be referenced by .config.AnnotationDrivenBeanDefinitionParser
This commit is contained in:
Chris Beams
2011-05-06 19:06:37 +00:00
parent 9a271ce6c9
commit 2bc3527f76
5 changed files with 82 additions and 33 deletions

View File

@@ -24,6 +24,7 @@ import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigUtils;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
@@ -42,27 +43,26 @@ public class AnnotationDrivenBeanDefinitionParserTests {
@Test
public void asyncPostProcessorRegistered() {
assertTrue(context.containsBean(
AnnotationDrivenBeanDefinitionParser.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME));
assertTrue(context.containsBean(AnnotationConfigUtils.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME));
}
@Test
public void scheduledPostProcessorRegistered() {
assertTrue(context.containsBean(
AnnotationDrivenBeanDefinitionParser.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME));
AnnotationConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME));
}
@Test
public void asyncPostProcessorExecutorReference() {
Object executor = context.getBean("testExecutor");
Object postProcessor = context.getBean(AnnotationDrivenBeanDefinitionParser.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME);
Object postProcessor = context.getBean(AnnotationConfigUtils.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME);
assertSame(executor, new DirectFieldAccessor(postProcessor).getPropertyValue("executor"));
}
@Test
public void scheduledPostProcessorSchedulerReference() {
Object scheduler = context.getBean("testScheduler");
Object postProcessor = context.getBean(AnnotationDrivenBeanDefinitionParser.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME);
Object postProcessor = context.getBean(AnnotationConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME);
assertSame(scheduler, new DirectFieldAccessor(postProcessor).getPropertyValue("scheduler"));
}