Spring 自动配置已排除,但仍在使用嵌入式servlet容器
我遵循了文档中提到的所有步骤来启用spring boot应用程序的传统war部署,即从Spring 自动配置已排除,但仍在使用嵌入式servlet容器,spring,spring-boot,Spring,Spring Boot,我遵循了文档中提到的所有步骤来启用spring boot应用程序的传统war部署,即从@EnableAutoConfiguration中排除了EmbeddedServletContainerAutoConfiguration,我只有一个这样的实例。还扩展了SpringBootServletInitializer,并确保打包的war没有任何tomcat启动程序依赖项。还运行了spring引导报告并确认EmbeddedServletContainerAutoConfiguration在排除列表中 除
@EnableAutoConfiguration
中排除了EmbeddedServletContainerAutoConfiguration
,我只有一个这样的实例。还扩展了SpringBootServletInitializer
,并确保打包的war没有任何tomcat启动程序依赖项。还运行了spring引导报告并确认EmbeddedServletContainerAutoConfiguration
在排除列表中
除了部署war时的所有更改之外,它仍然使用嵌入式servlet contatiner创建嵌入式应用程序上下文
我遗漏了什么?我还可以检查哪些其他区域?Spring boot版本1.5.13。>
嗨
我们不需要排除自动配置类
,但需要排除tomcat
依赖项
您需要做的是从pom.xml
中省略tomcatstarter
依赖项。它作为一个可传递的依赖项从spring boot starter web中获取。因此,您需要为其添加排除:
<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>
希望这有帮助 >
嗨
我们不需要排除自动配置类
,但需要排除tomcat
依赖项
您需要做的是从pom.xml
中省略tomcatstarter
依赖项。它作为一个可传递的依赖项从spring boot starter web中获取。因此,您需要为其添加排除:
<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>
希望这有帮助 发布你的代码。。。检查mvn dependency:tree,这样tomcat就不会有其他东西了。。。检查mvn dependency:tree,以便tomcat中没有其他内容。