Hi Team,
I tried the below code in sling models but I got error for declaring adapters -
@Model(adaptables = Resource.class, adapters = MyModel.class)
public class MySlingModel {
}
I'm using the below dependencies -
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.models.api</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
Earlier I used for the version 1.0.0. But it is not working. I'm unable to use adapters.
Can you pls help me in this?
Thanks,
AryA.
Solved! Go to Solution.
Views
Replies
Total Likes
You have used @Model incorrectly.
There is no way to create a Sling Model from more than one adaptable, Your class can adapt to multiple means it can adapt to different classes but at one point of time only one.
Read more about How to use Sling Model with Sightly in AEM
regards,
Ankur Ahlawat
Views
Replies
Total Likes
What version of AEM are you using?
Views
Replies
Total Likes
We are going to release a new AEM 6.2 SLing Model Article. I will post soon.
Views
Replies
Total Likes
Hi
Please refer to :- https://helpx.adobe.com/experience-manager/using/sling_models.html
//
Adding following dependency to the pom.xml help overcoming this problem:
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-atinject_1.0_spec</artifactId>
<version>1.0</version> <scope>provided</scope>
</dependency>
Reference :- Go to depfinder:- http://localhost:4502/system/console/depfinder [to find out dependency]
Please let me know, what exactly is the error coming?
PS:- Please add the dependency mentioned. Even the article Link mentioned by me is missing with this dependency, so add it and run it.
Thanks and Regards
Kautuk Sahni
Views
Replies
Total Likes
smacdonald2008 wrote...
We are going to release a new AEM 6.2 SLing Model Article. I will post soon.
Article Released:- https://helpx.adobe.com/experience-manager/using/slingmodel_62.html
~kautuk
Views
Replies
Total Likes
You have used @Model incorrectly.
There is no way to create a Sling Model from more than one adaptable, Your class can adapt to multiple means it can adapt to different classes but at one point of time only one.
Read more about How to use Sling Model with Sightly in AEM
regards,
Ankur Ahlawat
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies