报错是说找不到容器工厂类,一个原因是pom里没有引入embedtomcat,
第二个是用错了注解SpringBootApplication

//pom.xml   要有starter,表示使用内置tomcat容器

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.1.RELEASE</version>
    </parent>
<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>
//错误注解在main启动类上面
import org.springframework.boot.SpringBootConfiguration;

@SpringBootConfiguration
//正确注解,放在main启动类上
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
Logo

云原生社区为您提供最前沿的新闻资讯和知识内容

更多推荐