1. `@Component` @Component(name = "exampleComponent", service = ExampleService.class) public class ExampleComponent implements ExampleService { // class implementation } 2. `@Property` @Component(name = "exampleComponent") public class ExampleComponent { @Property(value = "defaultValue", name = "custom.property") private String customProperty; // class implementation } 3. `@Reference` @Component(name = "exampleComponent") public class ExampleComponent { @Reference(service = ExampleService.class) private ExampleService exampleService; // class implementation } @Component(name = "exampleComponent") public class ExampleComponent { @Activate protected void activate(ComponentContext context) { // activation logic } @Deactivate protected void deactivate(ComponentContext context) { // deactivation logic } // class implementation }


上一篇:
下一篇:
切换中文