我是Spring集成的新手,我正在使用以下代码,
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
"trail03ApplicationContext.xml");
MessageChannel channel = applicationContext.getBean(
"helloMessageChannel", MessageChannel.class);
Message<String> message = MessageBuilder.withPayload("World").build();
channel.send(message);
}
}
我在代码中没有任何问题,但是在发送消息后jvm没有退出。它仍然在后台运行。从jvmvisual观察者可以看出这一点。是否有任何需要关闭的东西。我正在使用eclipse来测试应用程序。
这是我的应用程序上下文
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<channel id="helloMessageChannel">
</channel>
<gateway service-interface="trail03.api.MessageService" id="myGateway" default-request-channel="helloMessageChannel"/>
<service-activator input-channel="helloMessageChannel"
ref="helloMessageService" method="sayHello" />
<beans:bean id="helloMessageService" class="trail03.impl.MessageServiceImpl" />