Ad Code

Monday, March 20, 2017

Run Modes with Use Cases In AEM 6.2 - Part2


In the Run Modes -Part1, We have discussed about the purpose of Run Modes.

In this blog we will explore the purpose of Run Modes in detail:
  • OSGi Component Creation for a specific environment.
  • Bundle Creation for a specific environment.

OSGi Component Creation for a specific environment
Run Modes helps to create OSGi component for the specific environment.
Problem Statement: To make OSGi Component to be available only for publish instance.
Solution: To solve this problem, follow these two steps:
  • Annotate the component with “ConfigurationPolicy.REQUIRE
  • Make this configuration available under config.publish.

Sample code of OSGi Component

👉 Here “policy= ConfigurationPolicy.REQUIRE”  means that this component should be available as configuration created under config nodes. But Initially, this configuration will not exist  in felix console components
So, to make it visible in Felix console of publish instance, You need to create configuration of this component (using Pid of OSGi Component) under config.publish node.

Fig- Node name same as Pid of OSGi Component

After addition of this configuration, you can see, the component will be available in Felix console in publish instance.
Note: In other run modes, this component will not get executed because it is specified only for publish instance. If you want to use it in other run modes, you need to make it in other config as well. (eg:,

Bundle Creation for a specific environment

Run Modes is not only used for configurations, they can also be used to differentiate bundles based on the environments.
Isn’t it sounds interesting??
Problem Statement: Let Suppose, You have multiple bundles in a single project. like
Bundle A” for  “Author” Environment.
Bundle Bfor  “Publish” Environment
Solution: So we need to make environment specific configuration for install folder.  (nt:folder)
                => Bundle A.jar
Install.publish (nt:folder)
                => Bundle B.jar
Fig- sgaem-test.jar for author and sgaem-bundle.jar for publish instance

Note: If you are in publish instance, You will not able to see bundle "sgaem-test" in felix console and vice-Versa for author instance.

Note: Here the question arises that how to create multiple bundles in an AEM Maven project? So stay tuned for next upcoming blog to get the answer of above question 👍.

Kindly share your feedback and contact us at for any query.

Thanks and Happy Learning 😊


  1. A IEEE project is an interrelated arrangement of exercises, having a positive beginning and end point and bringing about an interesting result in Engineering Colleges for a particular asset assignment working under a triple limitation - time, cost and execution. Final Year Project Domains for CSE In Engineering Colleges, final year IEEE Project Management requires the utilization of abilities and information to arrange, plan, plan, direct, control, screen, and assess a final year project for cse. The utilization of Project Management to accomplish authoritative objectives has expanded quickly and many engineering colleges have reacted with final year IEEE projects Project Centers in Chennai for CSE to help students in learning these remarkable abilities.

    Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining the authors explore the idea of using Java in Big Data platforms.
    Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai

  2. How can i inlcude runmodes for a multiple bundle project?

    suppose i have 5 bundles and inlcudes these bundles in one AEM project where we have one common bundles which have services and runmodes are same for all the bundles and we want to implements runmodes for each and every module how we can achieve it in AEM6.4?