Java 从tapestry组件侦听spring事件
首先,对不起,如果我做错了什么,这是我在stackOverflow上的第一篇文章。 现在,我的问题是: 可以在Tapestry组件中收听Spring主持的事件吗? 事件(ShopChangedEvent)是使用ApplicationEventPublisher从Spring front服务发布的,我想在front Tapestry组件中收听此事件。 我尝试将“implements ApplicationListener”添加到Tapestry组件并重写onApplicationEvent方法 谢谢大家,Java 从tapestry组件侦听spring事件,java,spring,events,tapestry,Java,Spring,Events,Tapestry,首先,对不起,如果我做错了什么,这是我在stackOverflow上的第一篇文章。 现在,我的问题是: 可以在Tapestry组件中收听Spring主持的事件吗? 事件(ShopChangedEvent)是使用ApplicationEventPublisher从Spring front服务发布的,我想在front Tapestry组件中收听此事件。 我尝试将“implements ApplicationListener”添加到Tapestry组件并重写onApplicationEvent方法 谢
阿尔贝托这是可能的,但可能不是你想要的 Tapestry组件在HTTP请求范围内“活动”。每次在TML标记Tapestry中使用UI组件时,只创建该组件的一个实例,并在所有HTTP请求中共享它
因此,即使您将UI组件订阅到ApplicationEventPublisher,您也无法在正确的请求周期内正确地“接收”事件。谢谢您!