[英]Error importing Spring Context Annotation
When I import a Controller annotation on Spring, the following error occours: 当我在Spring上导入Controller注释时,会出现以下错误:
The import org.springframework.stereotype.Controller conflicts with a type defined in the same file
Here goes the (very simple) code of my starting web-MVC project: 这是我开始的web-MVC项目的(非常简单的)代码:
package com.company.project.servlet;
import org.springframework.stereotype.Controller;
@Controller
public class Controller {
public String execute(){
System.out.println("Controller executing...");
return("page");
}
}
As you can see, it is aparently no reason to an error be shown here. 正如您所看到的,显然没有理由在此处显示错误。 Have you any idea on what should be happening?
你知道应该发生什么吗? Thanks!
谢谢!
Usefull information: - Eclipse Spring Tool Suite 3.3.0 (over Kepler) - Eclipse jars version 4.0.0.M1 (It should be the lattest versions of all these stuff) 有用的信息: - Eclipse Spring Tool Suite 3.3.0(通过Kepler) - Eclipse jar版本4.0.0.M1(它应该是所有这些东西的最新版本)
The message says it all : 消息说明了一切:
The import org.springframework.stereotype.Controller conflicts with a type defined in the same file
导入org.springframework.stereotype.Controller与同一文件中定义的类型冲突
You have defined a single type in your file: the class Controller
, which conflicts with the annotation Controller
. 您已在文件中定义了单个类型:类
Controller
,它与注释Controller
冲突。
@Controller ---> same name
^
|
public class Controller {
Choose another name, or use the fully qualified name of the enum: 选择其他名称,或使用枚举的完全限定名称:
@org.springframework.stereotype.Controller
public class Controller {
@Controller
是一个关键字,因此请选择其他类名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.