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.
Solved! Go to Solution.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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)
Views
Replies
Total Likes
Hi All,
Thanks a lot for your reply.
Views
Replies
Total Likes
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
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Like
Replies
Views
Likes
Replies