AEM OSGI Configuration | Community
Skip to main content
Level 8
July 8, 2025

AEM OSGI Configuration

  • July 8, 2025
  • 1 reply
  • 340 views

Hi all,

 

What are all the means of creating AEM OSGI Configuration?

I mean configuration placeholder, not the actual configuration itself.

 

I saw an example using code: https://www.youtube.com/watch?v=_ebHx8LyCkQ.

 

Is it possible to create it manually using Felix console or some other means?

 

Appreciate all your responses.

 

Thanks,

RK.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Level 4
July 8, 2025

Hi @nsvsrk ,

 

OSGI Config:

  • Whenever we need to pass different values (ex: service endpoints) to the same parameters based on run mode(environment, ex: Dev), we shall use OSGI configs.
  • These configs help to make this change without touching code and restart the server.
  • There is a java class which read values from the respective configuration into code, in that java class we shall provide default values but in OSGI configuration we need to pass the actual value as this value take precedence.
@Getter @Component( service = SampleConfig.class, immediate = true, configurationPolicy = ConfigurationPolicy.REQUIRE ) @Designate(ocd = SampleConfig.Configuration.class) public class SampleConfig { … … @ObjectClassDefinition( name = “Sample”, description = “Sample” ) public @interface Configuration { @AttributeDefinition(name = “Prop1) String prop1(); @AttributeDefinition(name = “Prop2”) boolean prop2() default true; } }
  • As fas as i know, we can create through code only.

Thanks,

Raju.

nsvsrkAuthor
Level 8
July 10, 2025

Hi,

 

I want to mark this reply as correct.

 

But I do not see that button on this post.

 

Any ideas?

 

Thanks,

RK.