开发者

how to obtain spring context reference in jpbm 4.2 EventListener?

开发者 https://www.devze.com 2023-01-19 21:55 出处:网络
How to obtain spr开发者_运维百科ing context from within EventListener instance which gets notified following this transition of process:

How to obtain spr开发者_运维百科ing context from within EventListener instance which gets notified following this transition of process:

<transition g="-36,11" name="A" to="B">
   <event-listener class="com.test.handlers.MyRequestHandler">
   </event-listener>
</transition>

I want to be able to do something like the following in my

@Override
public void notify(EventListenerExecution execution) throws Exception {
..
MyOtherSpringBean sender = (MyOtherSpringBean )applicationContext.get("MyOtherSpringBean ");

Thanks in advance,

Denis


You can have your EventListener be part of the spring context, and hence you can inject other beans into it (using @Autowired private MyOtherSpringBean bean)

See this thread, and this issue

0

精彩评论

暂无评论...
验证码 换一张
取 消