-
Bug
-
Resolution: Done
-
Major
-
27.0.1.Final
-
None
We have a tool that will scan a web archive and wrap each filter, listener, and servlet in order to provide customized session support in a "portable" fashion. This has been working fine using pre-annotation web applications.
We've recently began updating our framework to support the latest Servlet features and have run into an issue with @PostConstruct (probably @PreDestroy as well, but I haven't verified it yet) being called twice. In this case, there is a Servlet included in a web-fragment jar that has @PostConstruct defined. The web-fragment.xml doesn't reference this servlet, but instead references a wrapper around it. When the init() method is called on the wrapper, it calls ServletContext.createServlet() with the wrapped servlet class. After this call returns, the counter in the @PostConstruct implementation has been invoked twice.
I've attached (in call order) the call stacks I captured from Intellij.
See the attached test case: wf-repro.tar.gz