Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java EclipseDI不创建用Created注释的自定义对象_Java_Dependency Injection_Eclipse Rcp_E4 - Fatal编程技术网

Java EclipseDI不创建用Created注释的自定义对象

Java EclipseDI不创建用Created注释的自定义对象,java,dependency-injection,eclipse-rcp,e4,Java,Dependency Injection,Eclipse Rcp,E4,我正在开发一个基于4.4 Luna版本的Eclipse RCP应用程序 我有以下课程: public class NewProjectDialog extends TitleAreaDialog { @Inject private ProjectManager projectManager; // some code } 及 当我运行应用程序并打开NewProjectDialog时,会引发以下异常: org.eclipse.e4.core.di.InjectionException: o

我正在开发一个基于4.4 Luna版本的Eclipse RCP应用程序

我有以下课程:

public class NewProjectDialog extends TitleAreaDialog {
@Inject
private ProjectManager projectManager; 
// some code  
}

当我运行应用程序并打开
NewProjectDialog
时,会引发以下异常:

org.eclipse.e4.core.di.InjectionException: org.eclipse.e4.core.di.
InjectionException: Unable to process "NewProjectDialog.projectManager": 
no actual value was found for the argument "ProjectManager".

除了
@createable
注释之外,当Eclipse DI在上下文中找不到该类时,我必须做更多的事情来使它实例化该类吗?

我也面临同样的问题,并且greg-449已经给出的答案在问题的注释部分是正确的。是的,在注入/创建这些对象的字段时出现问题。

是不是
ProjectManager
在另一个插件中?如果是这样的话,包含它的包必须在插件的导出包列表中。不,它们都在同一个插件中,只是在不同的包中
NewProjectDialog
是通过
ContextInjectionFactory
创建的,但我想这并不重要。ProjectManager是否有一个
public
构造函数?看起来需要一个(如果有任何参数,则使用@Inject)。
ProjectManager
不包含任何构造函数,但包含两个注入字段。我已尝试使用
@Inject
注释创建默认构造函数,但仍有相同的异常。可能是由于在上下文中找不到注入的字段而出现问题。
org.eclipse.e4.core.di.InjectionException: org.eclipse.e4.core.di.
InjectionException: Unable to process "NewProjectDialog.projectManager": 
no actual value was found for the argument "ProjectManager".