SpringBoot报错Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: …

报错如下:

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
1 2020-05-18 18:22:56,088:ERROR org.springframework.boot.SpringApplication main (SpringApplication.java:815) - Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'XXXXXXXXXController': Unsatisfied dependency expressed through field 'XXXXXXXXXService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'XXXXXXXXXServiceImpl': Unsatisfied dependency expressed through field 'xxxService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'XXXXXXXXXServiceImpl': Unsatisfied dependency expressed through field 'XXXXXXXXXService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.xxx.xxx.xxxService': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is 
..........
.......
...

经过分析发现,是因为pom文件中没有指定springboot的版本,指定一下版本重新打包重启问题解决。

pom.xml指定

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.X.X.RELEASE</version>
            </plugin>
        </plugins>
    </build>

一定要指定版本

<version>2.X.X.RELEASE</version>