diff --git a/org.springframework.integration.test/src/test/java/org/springframework/integration/test/mockito/ServiceActivatorOnMockitoMockTests-context.xml b/org.springframework.integration.test/src/test/java/org/springframework/integration/test/mockito/ServiceActivatorOnMockitoMockTests-context.xml
index 7ee8fdf5ee..5ed0f63b87 100644
--- a/org.springframework.integration.test/src/test/java/org/springframework/integration/test/mockito/ServiceActivatorOnMockitoMockTests-context.xml
+++ b/org.springframework.integration.test/src/test/java/org/springframework/integration/test/mockito/ServiceActivatorOnMockitoMockTests-context.xml
@@ -14,7 +14,7 @@
-
+
diff --git a/org.springframework.integration.test/src/test/java/org/springframework/integration/test/mockito/ServiceActivatorOnMockitoMockTests.java b/org.springframework.integration.test/src/test/java/org/springframework/integration/test/mockito/ServiceActivatorOnMockitoMockTests.java
index 40e7832f8c..60d8a661e8 100644
--- a/org.springframework.integration.test/src/test/java/org/springframework/integration/test/mockito/ServiceActivatorOnMockitoMockTests.java
+++ b/org.springframework.integration.test/src/test/java/org/springframework/integration/test/mockito/ServiceActivatorOnMockitoMockTests.java
@@ -1,11 +1,26 @@
+/*
+ * Copyright 2002-2009 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.springframework.integration.test.mockito;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.channel.PollableChannel;
import org.springframework.integration.core.MessageChannel;
import org.springframework.integration.message.MessageBuilder;
@@ -13,11 +28,10 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
- *
+ * @author Iwein Fuld
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
-@Ignore//remove to reproduce INT-944
public class ServiceActivatorOnMockitoMockTests {
@Autowired @Qualifier("in")
@@ -27,7 +41,6 @@ public class ServiceActivatorOnMockitoMockTests {
PollableChannel out;
public static class SingleMethod {
- @ServiceActivator
public String move(String s){return s;};
}
diff --git a/org.springframework.integration/src/main/java/org/springframework/integration/handler/MethodInvokingMessageProcessor.java b/org.springframework.integration/src/main/java/org/springframework/integration/handler/MethodInvokingMessageProcessor.java
index d457cf08c5..6154359153 100644
--- a/org.springframework.integration/src/main/java/org/springframework/integration/handler/MethodInvokingMessageProcessor.java
+++ b/org.springframework.integration/src/main/java/org/springframework/integration/handler/MethodInvokingMessageProcessor.java
@@ -192,7 +192,8 @@ public class MethodInvokingMessageProcessor implements MessageProcessor {
final Map, HandlerMethod> candidateMethods = new HashMap, HandlerMethod>();
final Map, HandlerMethod> fallbackMethods = new HashMap, HandlerMethod>();
final AtomicReference> ambiguousFallbackType = new AtomicReference>();
- ReflectionUtils.doWithMethods(targetObject.getClass(), new MethodCallback() {
+ Class> targetClass = this.getTargetClass(targetObject);
+ ReflectionUtils.doWithMethods(targetClass, new MethodCallback() {
public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
boolean matchesAnnotation = false;
if (method.isBridge()) {
@@ -250,6 +251,20 @@ public class MethodInvokingMessageProcessor implements MessageProcessor {
return fallbackMethods;
}
+ private Class> getTargetClass(Object targetObject) {
+ Class> targetClass = targetObject.getClass();
+ if (AopUtils.isAopProxy(targetObject)) {
+ targetClass = AopUtils.getTargetClass(targetObject);
+ }
+ else if(AopUtils.isCglibProxyClass(targetClass)) {
+ Class> superClass = targetObject.getClass().getSuperclass();
+ if (!Object.class.equals(superClass)) {
+ targetClass = superClass;
+ }
+ }
+ return targetClass;
+ }
+
private List findHandlerMethodsForMessage(Message> message) {
final Class> payloadType = message.getPayload().getClass();
HandlerMethod closestMatch = this.findClosestMatch(payloadType);