2013-08-19 127 views
1

假设我有这个类:弹簧集成入站通道适配器在后构造触发?

public class MyClass { 
    public String myMethod() { 
     //... 
    } 
} 

我想我的应用程序启动时,发送结果myMethod()返回到Spring Integration的某个频道。我曾尝试:

<bean id="myClass" class="myPackage.MyClass"/> 

<int:inbound-channel-adapter channel="channelINeedToSendTo" ref="myClass" method="myMethod"> 
    <int:poller cron=""/> <!-- poller configuration --> 
</int:inbound-channel-adapter> 

现在我能配置轮询是调用myMethod()在一定的时间,就经常在一定的调度,但我想准确地运行应用程序启动(类似@PostConstruct后)。有没有简单的方法来实现这一点,而不需要复杂的AOP技术?

回答

2

您可以添加一个Event Inbound Channel Adapter来捕获ContextRefreshedEvent应用程序事件;然后将该适配器连接到调用myMethod()<service-activator/>;结果将在output-channel

相关问题