Problem with Sling Models in Adobe Experience Manager
I am working on below community article related to Sling Models. I follwed the steps given there but I am not able to map my Java Model/POJO.
https://helpx.adobe.com/experience-manager/using/sling_models.html
I have added below dependency to my pom.xml and I also added below tag inside maven bundle plugin to ensure the model/POJO will be adaptable
My POJO/Model class UserInfo.java is located inside "com.ritwik.poc.sling.models" package.
<Sling-Model-Packages>com.ritwik.poc.sling.models</Sling-Model-Packages>
<dependency>
<groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.models.api</artifactId> <version>1.0.0</version> <scope>provided</scope> </dependency>But I am getting null userInfo object when adapting from a sling resource .
Resource resource = resourceResolver.getResource("/content/testsling/slingmodel");
com.ritwik.poc.sling.models.UserInfo userInfo = resource.adaptTo(com.ritwik.poc.sling.models.UserInfo.class);
I am able to access resource properties using valuemap api. Kindly help me in fixing the issue.
Thanks
Abhilash Sathi