I am trying to inject my own service in enum class. Does anyone have any idea how to do it, is it even possible.
I have tried three ways
- Using ComponentAccessor
ComponentAccessor.getOSGiComponentInstanceOfType(MyClass.class)
- Setter injection
@Inject
public void setMyClass(MyClass myClass) {
this.myClass= myClass;
}
- Setter injection in a new class and accessing that class POJO way.
All the three ways throw something similar to below error
A LinkageError indicates that plugin code was compiled with outdated versions. Unable to run plugin code because of 'java.lang.ExceptionInInitializerError - null'
OR
A LinkageError indicates that plugin code was compiled with outdated versions. Unable to run plugin code because of 'java.lang.ExceptionInInitializerError - com.mypackage.Myclass'