() {
+ public Method run() {
+ return findDestroyMethod();
+ }
+ });
+ }
+ else {
+ return findDestroyMethod();
+ }
+ }
+ catch (IllegalArgumentException ex) {
+ throw new BeanDefinitionValidationException("Couldn't find a unique destroy method on bean with name '" +
+ this.beanName + ": " + ex.getMessage());
+ }
+ }
+
+ private Method findDestroyMethod() {
+ return (this.nonPublicAccessAllowed ?
+ BeanUtils.findMethodWithMinimalParameters(this.bean.getClass(), this.destroyMethodName) :
+ BeanUtils.findMethodWithMinimalParameters(this.bean.getClass().getMethods(), this.destroyMethodName));
+ }
+
/**
* Invoke the specified custom destroy method on the given bean.
* This implementation invokes a no-arg method if found, else checking
@@ -250,7 +256,6 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
return null;
}
});
-
try {
AccessController.doPrivileged(new PrivilegedExceptionAction