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

时光毁灭记忆、已成空白 提交于 2019-12-02 02:39:32

You need to add @SpringBootApplication to your main class.

@EnableGemfireRepositories
@SpringBootApplication
public class Application implements CommandLineRunner {

and in your pom add spring-boot-starter-web dependency instead of spring-web

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

To simplify your Pivotal GemFire configuration in your Spring Boot application, you might consider using (starting with the) Spring Boot for Pivotal GemFire (SBDG) project.

SBDG builds on Spring Data for Pivotal GemFire (SDG) along with other Spring projects, obviously Spring Boot, but also Spring Session for Pivotal GemFire (SSDG; here), as well. It applies all the concepts of Spring Boot (e.g. opinionated, "convention over configuration" using auto-configuration, etc) when developing Pivotal GemFire applications with Spring in general, and Spring Boot in particular.

For instance, in your application, SBDG would automatically auto-configure SD[G] Repositories, making the explicit declaration of @EnableGemfireRepositories unnecessary.

There are many other benefits to using SBDG, too.

Food for thought.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!