how servlet is registered




I referred h following helpx doc to create an osgi service

Adobe Experience Manager Help | Creating your first Adobe Experience Manager Service using an Maven ...

In the  above specified method i don understand how my service is being registered.

Needed help in understanding how the above service is being registered.

I read in most  of the articles that the service can be registered by ASSIGNING SOME INTERFACE  , BY BUNDLEACTIVATOR etc.. when these comes in to picture and in which phase of

I didnt really understand how they work.

Guidance will be most helpfull.






This is all explained in this Sling Documentation:

Apache Sling :: Servlets and Scripts

Most HELPX articles use Sling Resources or Sling Paths - as explained in this doc topic.





For you to understand the services clearly, you need to understand the same from OSGI perspective. It is basically object instance registered in Felix Console. I think it would be better for you to read some documentation around the same to start with . https://osgi.org/download/osgi.core-7.0.0-early-draft-2017-10.pdf  This is a draft version I took from the OSGI website, and page 133 specifies you what exactly a service is in OSGI perspective. That said, for you to register any class as service you need to have atleast 1 interface.

Once you have the interface/s ready , you can implement those to a service using @Service (this is now an old approach using Apache Felix Maven SCR ) Going forward , we need to use OSGI annotations according to OSGI R6 specifications , using which you need to use the below syntax to implement any interface as service

You can read more about these changes here Official OSGi Declarative Services Annotations in AEM - Adobe Experience Manager | AEM/CQ | Apache S...  .  Not with regard to AEM, but a general understanding of OSGI Services can be acheibed using tutorials by Lars Vogel OSGi Services - Tutorial . Hope this helps. Let me knwo if you need more information