开发者

Is the @Resource annotation applied when a Stateless EJB is deserialized?

开发者 https://www.devze.com 2023-01-26 22:11 出处:网络
Is the @Resource annotation on a method applied when an EJB is deserialized? I have a EJB Timer thats persisted by the container and would like to know if the transient TimerService (it\'s not seriali

Is the @Resource annotation on a method applied when an EJB is deserialized? I have a EJB Timer thats persisted by the container and would like to know if the transient TimerService (it's not serializable) w开发者_Go百科ill be injected again when the EJB is deserialized.


Perhaps this articles help:

  • Stateless Session Bean: the stateless session EJB is injected at creation time, and keeps it's resources along its life time.

  • Stateful Session Bean: It seems that the dependency injection only occurs at creation time. Anyway, after activation, the @PostActivate callback Handler is invoked, where you could recover your transient elements.

Edit for adding the Java EE Tutorial link on this subject, which confirms what is exposed:

  • The Life Cycles of Enterprise Beans

So, as a conclusion, the answer is no, the container won't inject again your transient resources after activation, but you can implement a PostActivate handler to do it by your own means.

0

精彩评论

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