我尝试编写一个spring cloud config server example.My maven的pom config
<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文件
请帮帮我,谢谢!
答案 0 :(得分:0)
你的pom是否有像这样的spring.verion属性:
<properties>
<spring.version>4.3.8.RELEASE</spring.version>
</properties>
如果在运行&mvn spring-boot时运行spring.verion属性,spring-boot-maven-plugin和Spring Config,则会出现错误:run&#39;命令。
[错误]无法执行目标org.springframework.boot:spring-boot-maven-plugin:1.5.8.RELEASE:在没有父项目的情况下运行(default-cli):运行时发生异常。 null:InvocationTargetException:创建名称为&#39; propertiesBasedSshTransportCallback&#39;在类路径资源[org / springframework / cloud / config / server / config / TransportConfiguration.class]中定义:通过工厂方法的Bean实例化失败;嵌套异常是org.springframework.beans.BeanInstantiationException:无法实例化[org.eclipse.jgit.api.TransportConfigCallback]:工厂方法&#39; propertiesBasedSshTransportCallback&#39;抛出异常;嵌套异常是java.lang.AbstractMethodError:org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.forExecutables()Ljavax / validation / executable / ExecutableValidator; - &GT; [帮助1]