I have an AspectJ class using annotation @Aspect in my Java program and I would like to make a class constructor with an injection using @Inject to an interface class but it gave me error of NoAspectBoundException such as follow:
de.hpi.cloudraid.exception.InternalClientError: org.aspectj.lang.NoAspectBoundException: Exception while initializing de.hpi.cloudraid.service.MeasurementAspect: java.lang.NoSuchMethodError: de.hpi.cloudraid.service.MeasurementAspect: method <init>()V not found
Here is the snippet of my class:
@Aspect
public class MeasurementAspect {
private final RemoteStatisticService remoteStatisticService;
@Inject
public MeasurementAspect(RemoteStatisticService remoteStatisticService) {
this.remoteStatisticService = remoteStatisticService;
}
....
}
I tried to use normal injection like private @Inject RemoteStatisticService remoteStatisticService; but it gave me error of NullPointerException.
Any help is appreciated. Thanks