把appliction配置文件里配置的spring.view.prefix=/WEB-INF/jsp/ spring.view.suffix=.jsp 都注释掉, 新建一个配置类来代替它们。
@Configuration
public class JspWebConfiguration extends WebMvcConfigurerAdapter {
@Bean
public InternalResourceViewResolver viewResolver() {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setPrefix("/WEB-INF/jsp/");
viewResolver.setSuffix(".jsp");
viewResolver.setViewClass(JstlView.class);
return viewResolver;
}
}