Property in OSGI | Community
Skip to main content
Level 3
October 16, 2015
Solved

Property in OSGI

  • October 16, 2015
  • 2 replies
  • 620 views

Hi everyone,

Can I add a custom property on my OSGI service?

ex.

@Properties({
    @Property(name ="NewValue", intValue = 0, propertyPrivate = false, label="custom value")})
@Service
public class NameClass

 

If I can, How I access to the property in my source code?

 

Thanks,

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

Yes - in your activate method, you can read the properties. Here's an example picked at random from ACS AEM Commons: https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/adobe/acs/commons/logging/impl/SyslogAppender.java

2 replies

JustinEd3Adobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

Yes - in your activate method, you can read the properties. Here's an example picked at random from ACS AEM Commons: https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/adobe/acs/commons/logging/impl/SyslogAppender.java

Lokesh_Shivalingaiah
Level 10
October 16, 2015

You can get using "properties.get(<propertyname>)"