AEM 6.3 sling models implementation Error: cannot be correctly instantiated by the Use API?
I try to write a class called Article.java.
if I do this
@Model(adaptables=Resource.class)
public class Article {
@Inject @Default(values="")
private String title;
}
it works fine by retrieving from the article.html using <a data-sly-use.article="mycomponents.Article">
However, try to following the acs-aem sample code to implement an interface called Article, and another class called ArticleImpl as below
@Model(adaptables = SlingHttpServletRequest.class, adapters = Article.class, resourceType = ArticleImpl.RESOURCE_TYPE)
@Exporter(name = Constants.EXPORTER_NAME, extensions = Constants.EXPORTER_EXTENSION)
public class ArticleImpl implements Article {
@ValueMapValue(optional = true, name = "title")
private String title;
}
When trying to retrieve the title from article component, I am getting the error below
Java.lang.NoSuchMethodException: mycomponents.Article.<init>() (in this implementation, mycomponents.Article is an interface)
An InstatiationException issue.
I don't see the sample code to create a default constructor.
Please help.
Thanks.
