@Override
public void addViewControllers(ViewControllerRegistry registry) {
    registry.addViewController("/test").setViewName("/test");
}

 

其中 addViewController("/test"),是URL路径,就是http://localhost:8080/test

setViewName("/test")是你HTML或JSP页面名称   test.html或test.jsp。

更多推荐

Spring MVC 的addViewControllers