idea mvc映射不起作用

web mvc项目,xml读取的到控制器,下面是mvc配置


web.xml配置


spring
/

控制器

@Controller
@RequestMapping(value = "/")
public class mainController {

@Autowired

private TestService testService;

@RequestMapping(value = "login", method = RequestMethod.GET)
public String login(
){
System.out.print("login\n");
//view/index.jsp
return "login";
}

tomcat app context 为默认的

运行结果

警告 [http-nio-8080-exec-1] org.springframework.web.servlet.PageNotFound.noHandlerFound No mapping found for HTTP request with URI [/] in DispatcherServlet with name 'spring'

一直找不到原因,原本的项目在eclipse里可以正常运行

https://www.cnblogs.com/sonng/p/7099923.html