我需要一种在当前 EAR 服务启动完成时被调用的方法。特别是网络服务。注释很有用@PostConstruct
,但为时过早。带注释的伪server.log
应该显示问题:
// All JNDI bindings get established
[2020-05-19... Portable JNDI names for EJB TemplateCreator: [java:global/AllInOne/L...]
// @PostConstruct methods get called. Far too early.
[2020-05-19... Trying to interact with web services failed]
// Starting of web services
[2020-05-19... Mojarra 2.3.14... for context '/app' gets initialized]
[2020-05-19... Loading application [AllInOne#TheApp.war] at [/app]]]
// Other web services get started the same...
// ========== This! Exactly here I need the call! Not earlier! =================
@PostConstruct
在正确的时刻被调用的替代方案是什么?