我在作为 akka 演员启动的服务器的字段注入上遇到空指针异常。
计划部分:
private ActorRef myActor = Akka.system().actorOf(
new Props(Retreiver.class));
@Override
public void onStart(Application app) {
log.info("Starting schedular.....!");
Akka.system()
.scheduler()
.schedule(Duration.create(0, TimeUnit.MILLISECONDS),
Duration.create(30, TimeUnit.MINUTES), myActor, "tick",
Akka.system().dispatcher());
}
检索器类部分:
public class Retreiver extends UntypedActor {
private Logger.ALogger log = Logger.of(Retreiver .class);
@Inject
private myDataService dataService;
@Override
public void onReceive(Object arg0) throws Exception {
if (0 != dataService.getDataCount()) {
....
....
....
}
}
我的数据服务为空。请就此给我建议。
谢谢。