Monday 13 November 2017

How to fetch the configuration in aem cq

The Osgi configurations can be fetched programmatically to be consumed in any service.

Configuration node can be created by creating a node of Type sling:OsgiConfig.

The Osgi configurations can be accessed from http://localhost:4502/system/console/configMgr.

The following code uses ConfigurationAdmin to fetch the config.

@Reference

private ConfigurationAdmin configAdmin;

Configuration cnf=configAdmin.getConfiguration("<name-of-the-Confignode-created>");
 Dictionary<String, Object>str=cnf.getProperties(); //To get the properties stored at that node.
String val=str.get("<property-name>"); //To get the specific propert by name



No comments:

Post a Comment

extraClientlibs Usage

The purpose of property "extraClientlibs" is to selectively load client library for a dialog. This prevents the unnecessary load o...