Error while compiling a serivce
Hi all,
I am getting the error while creating the service in AEM, as I have created the interface and when I am calling it in my model class it's throwing the error.
package com.aem.demo.core.models;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import com.aem.demo.core.KeyService;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Default;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.settings.SlingSettingsService;
@Model(adaptables=Resource.class)
public class HelloWorldModel {
@Inject
private KeyService keyService ;
@Inject
private SlingSettingsService settings;
@Inject @Named("sling:resourceType") @Default(values="No resourceType")
protected String resourceType;
private String message;
@PostConstruct
protected void init() {
keyService.setKey(80);
message = "\tHello World!-value of key service is"+keyService.getKey()+"\n";
message += "\tThis is instance: " + settings.getSlingId() + "\n";
message += "\tResource type is: " + resourceType + "\n";
}
public String getMessage() {
return message;
}
}
After compiling the above code
Errors:
[ERROR] TestHelloWorldModel.setup:49 » NullPointer