开发者

Define a destroy-method in annotation-based bean?

开发者 https://www.devze.com 2023-03-11 04:57 出处:网络
I\'m looking for a way to tell spring which method on an annotation-based bean it should call when it\'s destryoing that bean.

I'm looking for a way to tell spring which method on an annotation-based bean it should call when it's destryoing that bean.

What I'm actually trying to achieve is, to be notified when a session-scoped bean is d开发者_如何学编程estroyed in order to persist some stuff from that session.


You need to implement DisposableBean, or (preferably) annotate the method with javax.annotation.PreDestroy, which is more portable.

0

精彩评论

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