2016-04-25 184 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 ...因此,也许我们应该删除它。