Annotation Interface AutoService
An annotation which, when applied to a type, indicates that the type should automatically be registered as a service
implementation into a service registry. The automatic registration happens based on service files which are
automatically emitted from an annotation processor during the build process. Files that are located in the
service directory inside a jar file will be automatically loaded and the given service implementation types
will be resolved and registered. Each line of the file should contain one service implementation class binary name.- Since:
- 4.0
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanIndicates if the annotated service type should be marked as the default service implementation after registration.booleanIndicates if the annotated service implementation should be registered as a singleton instance.
-
Element Details
-
services
-
name
-
singleton
boolean singletonIndicates if the annotated service implementation should be registered as a singleton instance. If that is the case, the instance of the class is resolved using dependency injection and registered into the registry. If this property is set to false the annotated implementation type will be constructed on each service instance retrieval using the public no-args constructor in the annotated class.- Returns:
- true if the service should be registered as a singleton, false to retrieve a new instance each time.
- Default:
true
-
markAsDefault
boolean markAsDefaultIndicates if the annotated service type should be marked as the default service implementation after registration.- Returns:
- true if the service should be marked as the default after registration, false otherwise.
- Default:
false
-