idea中的springboot项目访问不到jsp

解决方案 https://blog.csdn.net/admin1973/article/details/80119696

其中第二种方法添加配置类,springboot 2.x版本,废弃了原来的 EmbeddedServletContainerCustomizer 替换成了 WebServerFactoryCustomizer

TomcatEmbeddedServletContainerFactory 也被替换成了TomcatServletWebServerFactory

@Configuration
public class CommonConfiguration {
    @Bean
    public AbstractServletWebServerFactory embeddedServletContainerFactory(){
        TomcatServletWebServerFactory tomcatServletWebServerFactory = new TomcatServletWebServerFactory();
        tomcatServletWebServerFactory.setDocumentRoot(new File("webapp的路径"));
        return tomcatServletWebServerFactory;
    }
}

原文链接: https://segmentfault.com/a/1190000014610478

猜你喜欢

转载自blog.csdn.net/weixin_44526589/article/details/105395803