consistent loading of optional classes
This commit is contained in:
@@ -140,16 +140,15 @@ public class CommonAnnotationBeanPostProcessor extends InitDestroyAnnotationBean
|
||||
private static Class<? extends Annotation> ejbRefClass = null;
|
||||
|
||||
static {
|
||||
ClassLoader cl = CommonAnnotationBeanPostProcessor.class.getClassLoader();
|
||||
try {
|
||||
webServiceRefClass = ClassUtils.forName("javax.xml.ws.WebServiceRef",
|
||||
CommonAnnotationBeanPostProcessor.class.getClassLoader());
|
||||
webServiceRefClass = (Class) cl.loadClass("javax.xml.ws.WebServiceRef");
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
webServiceRefClass = null;
|
||||
}
|
||||
try {
|
||||
ejbRefClass = ClassUtils.forName("javax.ejb.EJB",
|
||||
CommonAnnotationBeanPostProcessor.class.getClassLoader());
|
||||
ejbRefClass = (Class) cl.loadClass("javax.ejb.EJB");
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
ejbRefClass = null;
|
||||
|
||||
@@ -32,7 +32,6 @@ import org.springframework.aop.support.annotation.AnnotationMatchingPointcut;
|
||||
import org.springframework.core.task.AsyncTaskExecutor;
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* Advisor that activates asynchronous method execution through the {@link Async}
|
||||
@@ -73,9 +72,9 @@ public class AsyncAnnotationAdvisor extends AbstractPointcutAdvisor {
|
||||
public AsyncAnnotationAdvisor(Executor executor) {
|
||||
Set<Class<? extends Annotation>> asyncAnnotationTypes = new LinkedHashSet<Class<? extends Annotation>>(2);
|
||||
asyncAnnotationTypes.add(Async.class);
|
||||
ClassLoader cl = AsyncAnnotationAdvisor.class.getClassLoader();
|
||||
try {
|
||||
asyncAnnotationTypes.add(ClassUtils.forName(
|
||||
"javax.ejb.Asynchronous", AsyncAnnotationAdvisor.class.getClassLoader()));
|
||||
asyncAnnotationTypes.add((Class) cl.loadClass("javax.ejb.Asynchronous"));
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
// If EJB 3.1 API not present, simply ignore.
|
||||
|
||||
Reference in New Issue
Block a user