2

we recently converted our project from JBoss seam to using Spring and JSF. Our controller needs to initialize some properties. Right now were simply using the constructor to call the initialization methods. Seam has @Factory annotation decorated to a method which is called whenever the accessed property/field is null. Does Spring have an equivalent annotation? Thanks a lot.

4

1 回答 1

2

不,但是 Spring 支持JSR-250 生命周期注释@PostConstruct/@PreDestroy,您可以在 bean 启动时使用它来进行内务处理。

实际上bean生命周期管理至少有三种机制,它们的交互和优先级在“组合生命周期机制”一章中解释

于 2013-05-06T12:43:52.413 回答