Hi Team
I am using sling models with sightly. I am trying to inject resource to my model as below. All the models are throwing same error saying Resource was not able to be injected. This was working sometimes before. Now for some reason I am getting this error. Could you please help
@Model(adaptables = Resource.class)
public class PdfDownloadModel {
private final Logger LOG = LoggerFactory.getLogger(getClass());
@Inject
private Resource resource;
ERROR
org.apache.sling.models.impl.ModelAdapterFactory Required properties [private org.apache.sling.api.resource.Resource com.core.pdfdownload.models.PdfDownloadModel.resource] on model class class com.core.pdfdownload.models.PdfDownloadModel were not able to be injected.
Thanks in Advance
Veena
Solved! Go to Solution.
Views
Replies
Total Likes
Hi All
It seems like my AEM instance got corrupted due to some compaction I have done. I have got a new Jar and setup the code and its working perfectly fine with my existing code base.
Thanks for all your help and time
Thanks
Veena
Views
Replies
Total Likes
You can better use @self to point to the resource
Views
Replies
Total Likes
Hi All
It seems like my AEM instance got corrupted due to some compaction I have done. I have got a new Jar and setup the code and its working perfectly fine with my existing code base.
Thanks for all your help and time
Thanks
Veena
Views
Replies
Total Likes
Still I would use @Self in your case
Views
Replies
Total Likes
Sure Feike. I will refactor the code to use @self :) Thanks for pointing out to me :)
Thanks
Veena
Views
Replies
Total Likes