DataController
package go.controller;
@Controller
public class DataController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String start(){
return "index";
}
WebMvcConfig
package go.config;
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer){
configurer.enable();
}
@Bean
public InternalResourceViewResolver viewResolver(){
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setPrefix("WEB-INF/pages");
viewResolver.setSuffix(".jsp");
return viewResolver;
}
}
StaticResourceConfiguration
package go.config;
public class StaticResourceConfiguration extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations("/**");
}
}
我在index.jsp
src/main/webapp/WEB-INF/pages/
为什么Spring Boot会显示404 Not found
?