У меня есть приложение E4, где мне нужно внедрить MApplication в первый созданный класс. Сам класс был создан внутри метода start в моем Activator и вызван там.
Мой класс называется FrameworkModule и выглядит так:
public class FrameworkModule implements ISubscription {
private static final Logger logger = LoggerFactory.getLogger(FrameworkModule.class);
private @Inject IEclipseContext context;
protected @Inject EPartService partService;
protected @Inject MApplication application;
protected @Inject EModelService modelService;
...
}
Активатор создаст вышеуказанный класс и запустит его метод. Метод запуска активатора выглядит так:
@Override
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
IEclipseContext eContext = EclipseContextFactory.getServiceContext(bundleContext);
ExecutorService service = Executors.newSingleThreadExecutor();
service.execute(() -> {
framework = ContextInjectionFactory.make(FrameworkModule.class, eContext);
framework.startup();
});
service.execute(() -> CacheUtil.getManager());
service.shutdown();
}
При запуске кода я получил следующую ошибку:
org.eclipse.e4.core.di.InjectionException: Unable to process "FrameworkModule.application": no actual value was found for the argument "MApplication".
at org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:488)
at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:479)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:128)
at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:411)
at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:333)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:202)
at com.xxx.client.eclipse.Activator.lambda$0(Activator.java:84)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Как я могу это исправить в моем классе FrameworkModule? Мне нужны все введенные классы там, и я не могу найти способ получить их там.