@Documented
@Qualifier
@Retention(value=RUNTIME)
@Target(value={FIELD,METHOD,TYPE,TYPE_USE})
public @interface Service
The behavior of this annotation depends on it's usage:
@Service
on both type and type_use will result in a definition
error.
Where this annotation is used affects how service scopes are supported:
@SingleComponent
,
@FactoryComponent
or @Dependent
bean - The provided service can be of any scope. The bean can either
implement ServiceFactory
or
PrototypeServiceFactory
or use
@Bundle
or @Prototype
to set it's
service scope. If none of those options are used the service is a singleton
scope service.@ApplicationScoped
bean - The provided service
is a singleton scope service unless the bean implements ServiceFactory
or PrototypeServiceFactory
.
It cannot use @Bundle
or @Prototype
to set it's service scope. Use of those annotations in this case will result
in a definition error.Modifier and Type | Optional Element and Description |
---|---|
java.lang.Class<?>[] |
value
Override the interfaces under which this service is published.
|
Copyright © OSGi Alliance (2000, 2018). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0