내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

Annotation related doubts

Avatar

Level 9

Hi All,

@Service, @Reference, @Properties, @component.

Have encountered the above four at various places, but was not able to get a good understanding on the same.

Can some one please explain these, with short snippet of code.

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Level 10

Just to explain in simple terms,

@component - to mention the class as a component which will follow the component lifecycle of activate and deactivate

@service - to mention that the OSGi component is a Service which can be exposed to others to use this service

@properties - to mention the properties of a service which can be configured

@reference - to create a dependency reference of another service within a service

원본 게시물의 솔루션 보기

3 답변 개

Avatar

Level 10

Here is where you can find theory on these annotations:

http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/scr-annotations.html

Read these community articles - they are used in them and you can build services that use them:

1 - https://helpx.adobe.com/experience-manager/using/first-osgi.html (uses  @Service and @Component)

2 - https://helpx.adobe.com/experience-manager/using/datasourcepool.html (uses the @Reference annotation to inject a DataSourcePool into the new AEM service)

3 - https://helpx.adobe.com/experience-manager/using/creating-custom-cq-tree.html (uses the @Properties annotation)

4 - https://helpx.adobe.com/experience-manager/using/damhandler.html (another example of using the @Properties annotation)

Avatar

Level 9

Hi All,

Thanks a lot for your reply.

Avatar

정확한 답변 작성자:
Level 10

Just to explain in simple terms,

@component - to mention the class as a component which will follow the component lifecycle of activate and deactivate

@service - to mention that the OSGi component is a Service which can be exposed to others to use this service

@properties - to mention the properties of a service which can be configured

@reference - to create a dependency reference of another service within a service