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 }

 

  

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM