2016-04-25 186 views
0

在默認的JHipster配置中,spring-boot-starter-webspring-boot-starter-tomcat從其依賴關係中排除。排除tomcat的依賴的原因可能包括:Spring Boot排除Tomcat依賴性

  • 部署戰成單獨的獨立Web應用程序服務器
  • 交換Tomcat的依賴另一個Web服務器,如碼頭

(摘自pom.xml

<dependency> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-web</artifactId> 
    <exclusions> 
     <exclusion> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-tomcat</artifactId> 
     </exclusion> 
    </exclusions> 
</dependency> 

此外還提供了2個配置文件用於運行dev或中的應用程序環境。這是我的困惑開始的地方......

在每個配置文件,一個額外的依賴聲明:

<profile> 
     <id>prod</id> 
     <dependencies> 
      <dependency> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-starter-tomcat</artifactId> 
      </dependency> 
     </dependencies> 
     ... 
    </profile> 

有爲什麼spring-boot-starter-tomcat依賴需要被排除在標準的依賴性和名單的理由然後包含在配置文件中?

那豈不是更好地從依賴刪除排除操作並具有:

<dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-web</artifactId> 
    </dependency> 
+0

你爲什麼不試試?如果它工作在github上打開一個問題。 –

回答

0

這實際上是遺留代碼:我們曾經有過一個「快」的個人資料,我們會使用Undertow而不是Tomcat,這就是爲什麼Tomcat依賴項被默認刪除。 我們一直在保留這一點,因爲我們想再次遷移到Undertow,但上次我們嘗試過我們有another issue ...因此,也許我們應該刪除它。