@Retention(value=CLASS)
@Target(value=METHOD)
public @interface Init
If some dependencies are declared using a named @ServiceDependency
annotation,
then the annotated method may optionally return a Map used to dynamically configure such
dependencies (Please refer to @ServiceDependency.name()
attribute for more
information about this feature).
After the init method returns, the component is then invoked in the method annotated with
@Start
, in order to notify that the component is about to be registered into the OSGi
registry (if this one provides a service). However, you can take control of when the service is registered,
using the @LifecycleController
annotation).
@Component public class VideoPlayer { @ServiceDependency LogService log; @Init void init() {} // initialize our service (the "log" dependency is already injected). }