Hi Team,
I am reading the resource path from the OSGI configuration and then adapting the resource to a sling model, it's returning null.
It's working fine when we explicitly save the configuration. But returning null after every build until unless the configuration is been saved.
Regards,
Viveka
Views
Replies
Total Likes
Are you talking about OSGi configurations that are read in an AEM Service?
Views
Replies
Total Likes
Hi Viveka,
Please create the OSGI configuration in code and place to desired run modes. So it will not get vanished after every build.
Some thing like /apps/project/config.dev/com.day.cq.commons.impl.ExternalizerImpl.xml
FYI, http://aempodcast.com/2016/infrastucture/best-practice-treat-osgi-configurations-code
Thanks!
Views
Replies
Total Likes
Hi Viveka,
If you are not maintaining OSGI configuration xml files explicitly, i would recommend you to have default value in OSGI service itself like as below.
@Properties({ @Property(name = "resource.path", value = "/content/we-retails")})
Note: Providing default values like this will resolve your issue where after every build your configuration is lost.
Or else you can created xml config files and have your configuration value added there.
Hope this helps
Views
Replies
Total Likes
I have already created xml configuration with default Value and we can able to read the configuration value from the Service class, But the issue is coming only on adapting the resource to a sling model (with out saving the configuration). It works perfectly fine once I save the OSGI configuration in web console.
Views
Replies
Total Likes
Save the configuration seems to be the workaround here.
Views
Replies
Total Likes
Hi Viveka,
Could you please post snippet of your sling model here.
Make sure you are injecting service to sling model in proper way.
Views
Replies
Total Likes
Views
Likes
Replies