How can you read properties from OSGi configuration in AEM 6.1 in a WCMUse class?

1 Answers
Answered by suresh

How to read properties from OSGi configuration in AEM 6.1 WCMUse class

How to read properties from OSGi configuration in AEM 6.1 WCMUse class

To read properties from OSGi configuration in an AEM 6.1 WCMUse class, you can follow these steps:

  1. Inject the Sling Configuration into your WCMUse class:
  2. 
        @Reference
        private ConfigurationAdmin configurationAdmin;
        
  3. Retrieve the Configuration object for your OSGi configuration:
  4. 
        Configuration configuration = configurationAdmin.getConfiguration("your.configuration.pid");
        
  5. Access the properties using the Configuration object:
  6. 
        String propertyValue = configuration.getProperties().get("your.property.key").toString();
        

By following these steps, you can easily read properties from OSGi configurations in your AEM 6.1 WCMUse class. This allows you to leverage the power of OSGi configurations in your AEM projects.

Answer for Question: How can you read properties from OSGi configuration in AEM 6.1 in a WCMUse class?