April 26, 2020
Estimated Post Reading Time ~

Annotation @reference is disallowed for this location

Issue:
Annotation @reference is disallowed for this location.

Solution:
There are multiple ways to use @Reference annotations in OSGi annotations.

Option 1:
@Reference
MyService myService;

Option 2:
private MyService myService;

@Reference
public void bindMyService(MyService myService) {
this.myService = myService;
}
public void unbindMyService(MyService myService) {
this.myService = myService;
}

To avoid this error use option 2.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.