我正在尝试获取方法入口点解析器以将有效负载转换为基类,如所请求方法的参数所示。然而,骡子并没有这样做。我可能做错了什么?
也就是说,给定以下配置:
<mule ...>
<spring:bean id="FooBean" class="foo.Foo" />
<flow name="test">
<vm:inbound-endpoint name="test.Name" path="test.Path" exchange-pattern="request-response" />
<component>
<method-entry-point-resolver>
<include-entry-point method="bar" />
</method-entry-point-resolver>
<spring-object bean="FooBean" />
</component>
</flow>
</mule>
并给出 foo.Foo:
package foo;
public class Foo {
public Foo() {
}
public String bar(final Object anObject) {
return "bar";
}
}
我希望以下测试能够通过,但事实并非如此。也就是说,我发送到流的有效负载是 anInteger
并且我希望 Mule 将其作为参数传递给Foo::bar
:
@Test
public void methodEntryPointResolverUpcasts() throws MuleException {
final MuleClient client = muleContext.getClient();
final MuleMessage reply = client.send("vm://test.Path", new Integer(1), null, RECEIVE_TIMEOUT);
assertEquals("bar", reply.getPayload());
}
相反,日志显示错误。这是一个相关的片段:
...
Message : Failed to find entry point for component, the following resolvers tried but failed: [
ExplicitMethodEntryPointResolver: Could not find entry point on: "foo.Foo" with arguments: "{class java.lang.Integer}"
]
...
Exception stack is:
1. Failed to find entry point for component, the following resolvers tried but failed: [
ExplicitMethodEntryPointResolver: Could not find entry point on: "foo.Foo" with arguments: "{class java.lang.Integer}"