When I import a Controller annotation on Spring, the following error occours:
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:
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)
@Controller
is a keyword, so choose another class name.
The message says it all :
The import org.springframework.stereotype.Controller conflicts with a type defined in the same file
You have defined a single type in your file: the class Controller
, which conflicts with the annotation 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 {
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With