Common Myths Around Sling Model | Community
Skip to main content
Umesh_Thakur
Community Advisor
Community Advisor
August 9, 2021

Common Myths Around Sling Model

  • August 9, 2021
  • 3 replies
  • 1039 views
  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

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

3 replies

VeenaVikraman
Community Advisor
Community Advisor
August 11, 2021

Thanks for sharing this @umesh_thakur 

kautuk_sahni
Community Manager
Community Manager
August 17, 2021

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

Kautuk Sahni
Manu_Mathew_
Community Advisor
Community Advisor
September 19, 2021

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