Why use @PostConstruct?

后端 未结 5 804
孤街浪徒
孤街浪徒 2020-11-22 11:49

In a managed bean, @PostConstruct is called after the regular Java object constructor.

Why would I use @PostConstruct to initialize by bean

5条回答
  •  青春惊慌失措
    2020-11-22 12:27

    Also constructor based initialisation will not work as intended whenever some kind of proxying or remoting is involved.

    The ct will get called whenever an EJB gets deserialized, and whenever a new proxy gets created for it...

提交回复
热议问题