Fork me on GitHub

Lifecycle Support

Each Sisu managed bean/component may optionally use annotations on methods to be called whenever the bean is started or stopped.

Those are

Annotation Method called… Leveraged Guice Hook
org.eclipse.sisu.PostConstruct (or javax.annotation.PostConstruct) Before bean is started com.google.inject.spi.InjectionListener.afterInjection(...)
org.eclipse.sisu.PreDestroy (or javax.annotation.PreDestroy) Before bean is stopped Is not called by default, only via Plexus API.

The annotations defined in JSR 250 are recognized in addition to the native Sisu ones when their classes are detected in the class path.

The support needs to be explicitly enabled by passing an instance of org.eclipse.sisu.bean.LifecycleModule when creating the Injector.