No SAL LifecycleAware onStop() notification received in plugin

I have a plguins2 plugin where I implement com.atlassian.sal.api.lifecycle.LifecycleAware to recieve notification when the component starts/stops (onStart() and onStop() respectively).

However, the problem is that onStop() is never called. Does anyone else experience the same thing? I’ve tested with Confluence 6.4 and 6.7, no difference. For a JIRA plugin this does work.

@andres.hammar - Same here. looks like there’s a public bug report to this effect. https://jira.atlassian.com/browse/CONFSERVER-55374

Potential workaround, assuming that you’re using Atlassian Spring Scanner in your plugin, are to use the javax.annotation.PostConstruct and javax.annotation.PreDestroy annotations on your start/stop methods instead of implementing LifeCycleAware. That’s not a 100% perfect fix for all use cases, as sometimes you need the Atlassian lifecycle specifically.