Enterprise Server discovers add-on components by identifying Java programming language classes that are annotated with the org.jvnet.hk2.annotation.Service annotation.
To identify a class as an implementation of an Enterprise Server service, add the org.jvnet.hk2.annotation.Service annotation at the class-definition level of your Java programming language class.
@Service public class SamplePlugin implements ConsoleProvider { ... }
The @Service annotation has the following elements. All elements are optional.
The name of the service. The default value is an empty string.
The scope to which this service implementation is tied. The default value is org.jvnet.hk2.component.PerLookup.class.
The factory class for the service implementation, if the service is created by a factory class rather than by calling the default constructor. If this element is specified, the factory component is activated, and Factory.getObject is used instead of the default constructor. The default value of the factory element is org.jvnet.hk2.component.Factory.class.
The following example shows how to use the optional elements of the @Service annotation:
@Service (name="MyService", scope=com.example.PerRequest.class, factory=com.example.MyCustomFactory) public class SamplePlugin implements ConsoleProvider { ... }