Hey folks I noticed an issue when creating a resource inside an application:
package org.superbiz; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import java.util.logging.Logger; public class Startup { private final Logger log = Logger.getLogger(Startup.class.getName()); @PostConstruct public void start() { log.info("*** " + getClass().getName() + " started ***"); } @PreDestroy public void stop() { log.info("*** " + getClass().getName() + " stopped ***"); } } and using WEB-INF/resources.xml to create the resource: <resources> <Resource id="Startup" class-name="org.superbiz.Startup"> # any properties you need can go here </Resource> </resources> It looks like my @PostConstruct is called ok, but my @PreDestroy is not. I believe this works ok with resources defined in tomee.xml, but I'm happy to check. I dug a bit deeper, and wrote a test. This appears to be an issue on both master and 1.7.x. I have created two PRs, and would appreciate any thoughts. https://github.com/apache/tomee/pull/91 https://github.com/apache/tomee/pull/92 Many thanks Jon