Howdy fellow devs 👋! We have learned in previous posts of this series about bundles and the framework on which they are built. Apache Felix is the OSGi implementation which is used by AEM.
OSGi provides a way to manage bundles and configurations. We can find all the Out of the box OSGi configurations at - http://localhost:4502/system/console/configMgr. Apart from out of the box configurations, we can also create our custom configurations. In this post, we are going to do just that.
Let’s take a use case where we want to create a simple HTML card component in which we would like to use following four things -
1. Card Title
2. Organization Name
3. Button Text
4. Organization’s Homepage URL
Since Card Title and Button Text will be different for different cards, therefore, we will configure them in the component’s dialog. On the other hand, Organization Name and Homepage URL will be same for all the cards, it’s only wise to read these two properties from the OSGi configuration. Cool, eh 😎?
Similar to the above use case, we can leverage OSGi configurations for read properties that are supposed to be used at many places etc.