我是Spring Integration框架的新手,只是尝试实现一个基本示例,但是获得了空指针异常。
集成-spring.xml
<int:gateway service-interface="com.fil.MyService" default-request-
channel="in"/>
<int:chain input-channel="in">
<int:transformer expression="'hello:'+payload"></int:transformer>
<int:service-activator>
<int-groovy:script>
<![CDATA[println "processing"+payload]]>
</int-groovy:script>
</int:service-activator>
</int:chain>
</beans>
MyService.java
public interface MyService {
void single(String foo);
}
Test.java
@ContextConfiguration(locations = { "/WEB-INF/integration-spring.xml" })
public class MyServiceTest {
@Autowired
private MyService service;
@Test
public void test() {
try{
service.single("hELLO ");//Getting null pointer exception
}
catch(Exception e){
e.printStackTrace();
}
}}