[英]spring-cloud-config: spring-cloud-config maven config error
我嘗試編寫一個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文件
請幫幫我,謝謝!
您的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:run(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]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.