Hi All,
I have been following Adobe Experience Manager Help | Reading Adobe Experience Manager OSGi Configuration Values for reading properties in my code.
When i runt he sample provided it runs fine and gives correct output but when i integrate the same nodes and classes in my project, my service doesn't get registered on activation of bundle.
Since this sample uses the deprecated felix annotations i tried modifying it to current standards , now my service is registers but the activate method is never called.
I also saw one acs sample code on github SampleOsgiR6AnnotationsImpl.java but unable to understands if it is related to my requirement, since i dont see any connection with osgiConfig node.
What i need is able to read properties based on different run modes in my java file on bundle activation.
Can anyone please suggest for the same.
Solved! Go to Solution.
Views
Replies
Total Likes
The handling and injection of of OSGI properties, including the correct matching of runmodes should be left the framework. And from my point of view there is never a reason to bypass this. If you do, you are violating AEM best practices.
And if you really need to read the configuration for other environments (because otherwise the framework would it inject for you), something is wrong. Most likely you are using OSGI properties for a purpose they are not intended for.
Jörg
Views
Replies
Total Likes
Hi,
Please check for sample osgi service and how to call from servlet.
AEM6.4 @Reference not working in SlingServlet
and for reading osgi config without service
AEM osgiconfig node for different profile.
Views
Replies
Total Likes
Hi,
Seems you want to use the osgi configs per the run mode. It is usually picked in the AEM instance based on its runmode only. You can refer to public blogs like http://aempodcast.com/2016/apache-sling/demonstrate-slingosgiconfig-runmodes/#.XQo3npgzaUk to get more details.
Views
Replies
Total Likes
The handling and injection of of OSGI properties, including the correct matching of runmodes should be left the framework. And from my point of view there is never a reason to bypass this. If you do, you are violating AEM best practices.
And if you really need to read the configuration for other environments (because otherwise the framework would it inject for you), something is wrong. Most likely you are using OSGI properties for a purpose they are not intended for.
Jörg
Views
Replies
Total Likes
Views
Likes
Replies