INT-1735 Lifecycle methods now only match if the name/param-types match AND the Lifecycle interface is actually assignable from the declaring class

This commit is contained in:
Mark Fisher
2011-01-17 14:36:36 -05:00
parent c6a160a804
commit 0fd504dbe3

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2011 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. You may obtain a copy of the License at
@@ -71,12 +71,13 @@ public class ExpressionControlBusFactoryBean extends AbstractSimpleMessageHandle
return supportedMethods;
}
private boolean accept(Method method) {
if (ReflectionUtils.findMethod(Lifecycle.class, method.getName(), method.getParameterTypes()) != null){
private boolean accept(Method method) {
Class<?> declaringClass = method.getDeclaringClass();
if (Lifecycle.class.isAssignableFrom(declaringClass)
&& ReflectionUtils.findMethod(Lifecycle.class, method.getName(), method.getParameterTypes()) != null) {
return true;
}
if (CustomizableThreadCreator.class.isAssignableFrom(method.getDeclaringClass())
if (CustomizableThreadCreator.class.isAssignableFrom(declaringClass)
&& (method.getName().startsWith("get")
|| method.getName().startsWith("set")
|| method.getName().startsWith("shutdown"))) {