Spring Cloud Feign 启动UnsatisfiedDependencyException

时间:2022-05-06
本文章向大家介绍Spring Cloud Feign 启动UnsatisfiedDependencyException,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

在加入Swagger之后启动就报错了,由此可知肯定是冲突了

错误信息如下:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 

我目前的版本如下:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.4.RELEASE</version>
        <relativePath/>
 </parent>

 <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Dalston.SR1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
 </dependencyManagement>

swagger 是自己封装的starter,spring-boot-starter-swagge

版本如下:

<properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <springfox.version>2.2.2</springfox.version></properties><dependency>
     <groupId>io.springfox</groupId>
     <artifactId>springfox-swagger2</artifactId>
     <version>${springfox.version}</version>
 </dependency>
 <dependency>
     <groupId>io.springfox</groupId>
     <artifactId>springfox-swagger-ui</artifactId>
     <version>${springfox.version}</version>
 </dependency>

版本比较低,只要是升级到<springfox.version>2.5.0</springfox.version>就可以了