首页 文章

spring-cloud-config:spring-cloud-config maven config error

提问于
浏览
2

我尝试编写一个spring cloud配置服务器示例 . 我的maven的pom配置

<parent>
    <groupId>cn.bcolor</groupId>
    <artifactId>bcolor-parent-pom</artifactId>
    <version>1.0-SNAPSHOT</version>
</parent>

<groupId>cn.bcolor</groupId>
<artifactId>bcolor-config-center</artifactId>
<version>1.0.0</version>


<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-config-server</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-eureka</artifactId>
    </dependency>

</dependencies>

bcolor-parent-pom

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>1.5.9.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Edgware.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>

当我运行程序时,例外情况如下

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration$$EnhancerBySpringCGLIB$$29caa1fa]: Constructor threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'configServerHealthIndicator' defined in class path resource [org/springframework/cloud/config/server/config/EnvironmentRepositoryConfiguration.class]: Unsatisfied dependency expressed through method 'configServerHealthIndicator' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.config.server.config.CompositeConfiguration': Unsatisfied dependency expressed through method 'setEnvironmentRepos' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.config.server.config.DefaultRepositoryConfiguration': Unsatisfied dependency expressed through field 'transportConfigCallback'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'propertiesBasedSshTransportCallback' defined in class path resource [org/springframework/cloud/config/server/config/TransportConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.eclipse.jgit.api.TransportConfigCallback]: Factory method 'propertiesBasedSshTransportCallback' threw exception; nested exception is java.lang.AbstractMethodError: org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.forExecutables()Ljavax/validation/executable/ExecutableValidator;

我根据官方网站的例子进行配置 . 除了这个pom文件

请帮帮我,谢谢!

1 回答

  • 0

    你的pom有这样的spring.verion属性:

    <properties>
      <spring.version>4.3.8.RELEASE</spring.version>
    </properties>
    

    如果在运行'mvn spring-boot:run'命令时使用spring.verion属性,spring-boot-maven-plugin和Spring Config,则会出现错误 .


    [错误]无法执行目标org.springframework.boot:spring-boot-maven-plugin:1.5.8.RELEASE:在没有父项目的情况下运行(default-cli):运行时发生异常 . null:InvocationTargetException:在类路径资源[org / springframework / cloud / config / server / config / TransportConfiguration.class]中定义的名称为'propertiesBasedSshTransportCallback'的bean创建错误:通过工厂方法进行Bean实例化失败;嵌套异常是org.springframework.beans.BeanInstantiationException:无法实例化[org.eclipse.jgit.api.TransportConfigCallback]:工厂方法'propertiesBasedSshTransportCallback'抛出异常;嵌套异常是java.lang.AbstractMethodError:org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.forExecutables()Ljavax / validation / executable / ExecutableValidator; - > [帮助1]

相关问题