Spring Boot: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean

前端 未结 27 1222
一整个雨季
一整个雨季 2020-11-28 03:55

I am totally new to Spring and started to do the official guides from this site: https://spring.io/guides

I\'d like to do this guide: https://spring.io/guides/gs/sch

相关标签:
27条回答
  • 2020-11-28 04:52

    The scheduling guide isn't a web app so you probably have some mouldy stuff in your pom.xml from the REST guide? If you follow the instructions closely it should work. Another potential issue with the code you posted above is that your @EnableAutoConfiguration class is not used in the context, only as a main method (which may not be a problem for the scheduling guide but it probably is for a bunch of others).

    0 讨论(0)
  • 2020-11-28 04:52

    In my case we added the @Profile annotation newly in order to ignore the TestApplication class in production mode and the Application class in test mode.

    Unfortunately, we forgot to add the following line into the application.properties files:

    spring.profiles.active=test
    or
    spring.profiles.active=production
    

    Without these config no profile was loaded which caused the not-so-much saying Spring Error.

    0 讨论(0)
  • 2020-11-28 04:52

    In my case it happen after excluding the resource folder from the pom using the following code.

    <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <excludes>
                    <exclude>*/*.properties</exclude>
                </excludes>
            </resource>
    </resources>
    

    Commenting this code started my code.

    0 讨论(0)
提交回复
热议问题