Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 自动配置已排除,但仍在使用嵌入式servlet容器_Spring_Spring Boot - Fatal编程技术网

Spring 自动配置已排除,但仍在使用嵌入式servlet容器

Spring 自动配置已排除,但仍在使用嵌入式servlet容器,spring,spring-boot,Spring,Spring Boot,我遵循了文档中提到的所有步骤来启用spring boot应用程序的传统war部署,即从@EnableAutoConfiguration中排除了EmbeddedServletContainerAutoConfiguration,我只有一个这样的实例。还扩展了SpringBootServletInitializer,并确保打包的war没有任何tomcat启动程序依赖项。还运行了spring引导报告并确认EmbeddedServletContainerAutoConfiguration在排除列表中 除

我遵循了文档中提到的所有步骤来启用spring boot应用程序的传统war部署,即从
@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中没有其他内容。