Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean

其实是maven配置有问题,我把spring boot的内置容器干掉了,spring boot内置tomcat容器,我pom.xml是这样写的。

<dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                    <version>${springboot.version}</version>
                    <!--不需要打包成一个war包,或者说不用内置的spring容器,-->
                    <exclusions>
                        <exclusion>
                            <groupId>org.springframework.boot</groupId>
                            <artifactId>spring-boot-starter-tomcat</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

我的pom.xml把tomcat容器干掉了,然后我又没有什么容器能够运行,所以会报错。

我只需要使用其他容器就行,比如说下面的undertow 或者jetty

再加个依赖就能跑了

<!-- starter-undertow -->
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-undertow</artifactId>
                    <version>${springboot.version}</version>
                    <exclusions>
                        <exclusion>
                            <artifactId>jboss-logging</artifactId>
                            <groupId>org.jboss.logging</groupId>
                        </exclusion>
                    </exclusions>
                </dependency>

posted on 2017-11-17 18:29  Alex0111  阅读(593)  评论(0编辑  收藏  举报

导航