Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Common Myths Around Sling Model

Avatar

Community Advisor
  1. Sling model is only back-end business logic provider to AEM components.
  2. Adaptable are just a way to get respective sling object reference. For example if you need slingRequest object in sling model then make your sling model adaptable to HttpSlingServletRequest.
  3. You can not get a value from sling model in a servlet or in any other class.
  4. When you need a reference of an OSGI service, you have only one way, that is @ OSGiService annotation.
  5. You can export only JSON data thru sling model exporter.
  6. You can not extend one sling model into another sling model.
  7. Sling model can to be created outside of the designated package in AEM.
  8. One Interface can not be a Sling Model, whenever you need to create a Sling Model you will have to write a pure POJO concrete implemented java class.
  9. You can only read properties of a node thru sling model, you can not change a node property thru sling model.
  10. Constructor injection..! Nothing like that in sling model.

More details can be found on below URL

https://aemhelper.blogspot.com/2021/08/common-myths-around-sling-model.html

 

I found it very informative and useful.

Thanks

Umesh Thakur

3 Replies

Avatar

Administrator

@Umesh_Thakur , This is good read. Thank you for sharing this with AEM community. 



Kautuk Sahni

Avatar

Community Advisor

@Umesh_Thakur very informative and useful content. Thanks for sharing!