SpringBoot 2.2.5版本 无法跳转jsp页面
1,方式一 IDEA配置
步骤一:点击 edit configurations
步骤二:点击 Environment
步骤三:点击 working directory 选择第三个,点击应用ok。
2,方式二:添加一个配置文件。
1 @Configuration 2 public class GlobalConfig { 3 @Bean 4 public WebServerFactoryCustomizer<TomcatServletWebServerFactory> customizer() { 5 return (factory) -> { 6 factory.addContextCustomizers((context) -> { 7 //模块中webapp相对路径 8 String relativePath = "tt-web/src/main/webapp"; 9 File docBaseFile = new File(relativePath); 10 // 路径是否存在 11 if (docBaseFile.exists()) { 12 context.setDocBase(docBaseFile.getAbsolutePath()); 13 } 14 } 15 ); 16 }; 17 } 18 }