Java 春天如何将一些变量传递给ServiceActivator中的方法?

Java 春天如何将一些变量传递给ServiceActivator中的方法?,java,spring,spring-mvc,rss,Java,Spring,Spring Mvc,Rss,我是春天的新手,但我正在努力理解它。所以现在我试着创建RSS阅读器,但是Google中的所有例子都是多余的,我不理解它们。 到目前为止,我已经有了beans xml: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:int="http://www.springframewor

我是春天的新手,但我正在努力理解它。所以现在我试着创建RSS阅读器,但是Google中的所有例子都是多余的,我不理解它们。 到目前为止,我已经有了beans xml:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:int="http://www.springframework.org/schema/integration"
       xmlns:feed="http://www.springframework.org/schema/integration/feed"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/integration
                           http://www.springframework.org/schema/integration/spring-integration.xsd
                           http://www.springframework.org/schema/integration/feed
                           http://www.springframework.org/schema/integration/feed/spring-integration-feed.xsd">

    <int:channel id="inputRssFeedChannel"/>

    <feed:inbound-channel-adapter id="news"
                                  channel="inputRssFeedChannel"
                                  url="http://feeds.feedburner.com/Techcrunch">
        <int:poller fixed-rate="5000"/>
    </feed:inbound-channel-adapter>

    <int:service-activator input-channel="inputRssFeedChannel"
                           ref="rssPrintOutService"
                           method="printRss"/>

    <bean id="rssPrintOutService" class="MyApp.RssHandler"/>

</beans>

代码正确,我每5秒得到一次“GFFGFGFG”。但我无法理解如何将一些变量(Rss条目)传递给RssHandler以处理标题、日期等并在那里打印出来

Spring集成将来自特定通道的消息传递给处理程序。因此,您可以尝试以下方法:

public class RssHandler {
    private static final Logger theLogger = LoggerFactory.getLogger(RssHandler.class);

    public void printRss(Message m) { // The Message Object is in the spring integration packages or in the spring core packages depending on the version
        System.out.println(m);
    }

}

哇!非常感谢!正如我现在所理解的,我必须获取Synd对象并从中获取所有属性,对吗?
public class RssHandler {
    private static final Logger theLogger = LoggerFactory.getLogger(RssHandler.class);

    public void printRss(Message m) { // The Message Object is in the spring integration packages or in the spring core packages depending on the version
        System.out.println(m);
    }

}