Add exception-handler attribute support for AspectJ
Previously, the exception-handler attribute was not taken care of when task:annotation-driven is used in AspectJ mode. This commit provides the expected behavior. Issue: SPR-12619
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -27,6 +27,7 @@ import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class AnnotationDrivenBeanDefinitionParserTests {
|
||||
|
||||
@@ -64,4 +65,11 @@ public class AnnotationDrivenBeanDefinitionParserTests {
|
||||
assertSame(scheduler, new DirectFieldAccessor(postProcessor).getPropertyValue("scheduler"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void asyncPostProcessorExceptionHandlerReference() {
|
||||
Object exceptionHandler = context.getBean("testExceptionHandler");
|
||||
Object postProcessor = context.getBean(TaskManagementConfigUtils.ASYNC_ANNOTATION_PROCESSOR_BEAN_NAME);
|
||||
assertSame(exceptionHandler, new DirectFieldAccessor(postProcessor).getPropertyValue("exceptionHandler"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,10 +7,14 @@
|
||||
http://www.springframework.org/schema/task
|
||||
http://www.springframework.org/schema/task/spring-task.xsd">
|
||||
|
||||
<task:annotation-driven executor="testExecutor" scheduler="testScheduler"/>
|
||||
<task:annotation-driven executor="testExecutor" scheduler="testScheduler"
|
||||
exception-handler="testExceptionHandler"/>
|
||||
|
||||
<task:executor id="testExecutor"/>
|
||||
|
||||
<task:scheduler id="testScheduler"/>
|
||||
|
||||
<bean id="testExceptionHandler"
|
||||
class="org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler"/>
|
||||
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user