英文:
How to get called when glassfish finished starting web services in current EAR deployment
问题
我需要一种在当前EAR服务启动完成时被调用的方法,特别是web服务。
`@PostConstruct` 注解是有用的,但时间太早。
以下是一个注释掉的伪代码 `server.log`,展示了问题:
// 所有JNDI绑定都已建立
[2020-05-19... EJB TemplateCreator的可移植JNDI名称:[java:global/AllInOne/L...]]
// 调用 @PostConstruct 方法。时间过早。
[2020-05-19... 尝试与web服务交互失败]
// 启动web服务
[2020-05-19... Mojarra 2.3.14... 初始化上下文 '/app']
[2020-05-19... 在 [/app] 处加载应用程序 [AllInOne#TheApp.war]]
// 其他web服务同样启动...
// ========== 就是这里!我需要在这里调用!而不是更早! =================
有什么替代方案可以在正确的时刻被调用,而不使用 `@PostConstruct` ?
英文:
I need a way to get called when the start of the current EAR services are done. Specifically web services.
The @PostConstruct
annotation is usefull, but too early.
A commented pseudo server.log
should show the problem:
<!-- language: lang-java -->
// 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! =================
What would be the alternative to @PostConstruct
which gets called at the right moment?
专注分享java语言的经验与见解,让所有开发者获益!
评论