diff --git a/org.eclipse.sisu.inject/src/site/markdown/lifecycle.md b/org.eclipse.sisu.inject/src/site/markdown/lifecycle.md new file mode 100644 index 00000000..76f6c8ad --- /dev/null +++ b/org.eclipse.sisu.inject/src/site/markdown/lifecycle.md @@ -0,0 +1,14 @@ +# 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(...)`](https://google.github.io/guice/api-docs/6.0.0/javadoc/com/google/inject/spi/InjectionListener.html#afterInjection(I)) + `org.eclipse.sisu.PreDestroy` (or `javax.annotation.PreDestroy.`) | Before bean is stopped | Is not called by default, only via [Plexus API](../org.eclipse.sisu.plexus). + + The annotations defined in [JSR 250](https://jcp.org/en/jsr/detail?id=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`](apidocs/org/eclipse/sisu/bean/LifecycleModule.html) when creating the `Injector`. \ No newline at end of file diff --git a/org.eclipse.sisu.inject/src/site/site.xml b/org.eclipse.sisu.inject/src/site/site.xml index 3c1ac832..856ca555 100644 --- a/org.eclipse.sisu.inject/src/site/site.xml +++ b/org.eclipse.sisu.inject/src/site/site.xml @@ -14,6 +14,7 @@