当服务调用返回null(NullPayload
)时,为组件绑定生成的代理会抛出ClassCastException
。它应该返回null吗? (这是在Mule CE 3.2.1中)参见MULE 4405
由于
这是mule配置:
<mule ...>
<flow name="entryPoint">
<vm:inbound-endpoint
path="entryPoint"
exchange-pattern="request-response" />
<component class="classcastexception.Component">
<binding interface="classcastexception.Interface" method="foo">
<vm:outbound-endpoint
path="classcastexception.Interface.foo"
exchange-pattern="request-response" />
</binding>
</component>
</flow>
<flow name="classcastexception.Interface.foo">
<vm:inbound-endpoint
path="classcastexception.Interface.foo"
exchange-pattern="request-response" />
<component class="classcastexception.InterfaceImpl" />
</flow>
</mule>
java类是:
Interface.java
package classcastexception;
public interface Interface {
String foo(String s);
}
Component.java
package classcastexception;
public class Component {
private Interface i;
public String foo(final String s) {
return i.foo(s);
}
public void setInterface(final Interface i) {
this.i = i;
}
}
InterfaceImpl.java
package classcastexception;
public class InterfaceImpl implements Interface {
@Override
public String foo(String s) {
return null;
}
}