First, we have to make a service configuration by using the code given below. In this code I am showing you the normal way to show osgi config value. @Component(service = TestService.class, immediate = true) @Designate(ocd = TestService.TestConfig.class) public class TestService { @ObjectClassDefinition(name = “TestConfig”, description = “This is the test config”) public @interface TestConfig { @AttributeDefinition(name = “Title”, description = “Enter the title”) String myTitle(); @AttributeDefinition(name = “Description”, description = “Enter the description”) String myDesc(); } private String serviceTitle; private String serviceDesc; @Activate @Modified private void init(TestConfig testConfig) { serviceTitle = testConfig.myTitle(); serviceDesc = testConfig.myDesc(); } public String getServiceTitle() { return serviceTitle; } public String getServiceDesc() { return serviceDesc; } } By using the above code we will get our service configuration.
Please use this thread to ask the related questions.
Views
Replies
Total Likes