@Target(value={TYPE,ANNOTATION_TYPE}) public @interface Provides
@Component
@Provides
public class MyComponent implements Service {
// ...
}
| Modifier and Type | Optional Element and Description |
|---|---|
StaticServiceProperty[] |
properties
Allows adding static properties to the service.
|
Class[] |
specifications
Set the provided specifications.
|
String |
strategy
Set the service object creation strategy.
|
public abstract Class[] specifications
@Component
@Provides(specifications = AbsComponent.class)
public class MyComponent extends AbsComponent {
// ...
}
public abstract String strategy
CreationStrategy implementationpublic abstract StaticServiceProperty[] properties
StaticServiceProperty elements.
Default : No service properties
@Component
@Provides(
properties = {
@StaticServiceProperty(name = "size", type = "int", value = "5"),
@StaticServiceProperty(name = "name", type = "java.lang.String", value = "OSGi")
}
)
public class MyComponent implements Service {
// ...
}
Copyright © 2006–2023 The Apache Software Foundation. All rights reserved.