将 spring-cloud-sleuth 添加到类路径时出现 'Context Initialization' 错误
getting 'Context Initialization' error when adding spring-cloud-sleuth to classpath
下面提供了引用 spring-cloud-sleuth 的构建文件部分。
dependencyManagement {
imports {
//where springCloudVersion = "Dalston.SR5" & springBootVersion = '1.5.9.RELEASE'
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
//in dependencies, added the following line
compile 'org.springframework.cloud:spring-cloud-starter-sleuth'
添加该依赖后,应用启动失败,出现如下异常(根据评论添加)
support.AbstractApplicationContext (AbstractApplicationContext.java:551) -
Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'misds':
Could not bind properties to HikariDataSource (prefix=mis.datasource, ignoreInvalidFields=false, ignoreUnknownFields=true, ignoreNestedProperties=false); nested exception is org.springframework.validation.BindException: org.springframework.boot.bind.RelaxedDataBinder$RelaxedBeanPropertyBindingResult: 4 errors
Field error in object 'mis.datasource' on field 'driverClassName': rejected value [oracle.jdbc.OracleDriver];
codes [methodInvocation.mis.datasource.driverClassName,methodInvocation.driverClassName,methodInvocation.java.lang.String,methodInvocation];
arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [mis.datasource.driverClassName,driverClassName];
arguments []; default message [driverClassName]]; default message [Property 'driverClassName' threw exception;
nested exception is java.lang.IllegalStateException: The configuration of the pool is sealed once started.
Use HikariConfigMXBean for runtime changes.]
我正在使用 slf4j 而不是 log4j 作为日志记录框架,当我删除 sleuth 依赖项时应用程序运行正常。
我注意到当包含 spring-cloud 依赖项时,会出现以下 'additional' 属性源。
env.MutablePropertySources (MutablePropertySources.java:106) - Adding PropertySource 'springCloudClientHostInfo' with lowest search precedence
env.MutablePropertySources (MutablePropertySources.java:106) - Adding PropertySource 'defaultProperties' with lowest search precedence
env.MutablePropertySources (MutablePropertySources.java:106) - Adding PropertySource 'Management Server' with lowest search precedence
经常检查最新的发布系列是否不能解决您的问题。老实说,我真的不知道哪个问题与这个问题有关:/ Edgware release train is compatible with Boot < 2.0
下面提供了引用 spring-cloud-sleuth 的构建文件部分。
dependencyManagement {
imports {
//where springCloudVersion = "Dalston.SR5" & springBootVersion = '1.5.9.RELEASE'
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
//in dependencies, added the following line
compile 'org.springframework.cloud:spring-cloud-starter-sleuth'
添加该依赖后,应用启动失败,出现如下异常(根据评论添加)
support.AbstractApplicationContext (AbstractApplicationContext.java:551) -
Exception encountered during context initialization - cancelling refresh attempt:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'misds':
Could not bind properties to HikariDataSource (prefix=mis.datasource, ignoreInvalidFields=false, ignoreUnknownFields=true, ignoreNestedProperties=false); nested exception is org.springframework.validation.BindException: org.springframework.boot.bind.RelaxedDataBinder$RelaxedBeanPropertyBindingResult: 4 errors
Field error in object 'mis.datasource' on field 'driverClassName': rejected value [oracle.jdbc.OracleDriver];
codes [methodInvocation.mis.datasource.driverClassName,methodInvocation.driverClassName,methodInvocation.java.lang.String,methodInvocation];
arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [mis.datasource.driverClassName,driverClassName];
arguments []; default message [driverClassName]]; default message [Property 'driverClassName' threw exception;
nested exception is java.lang.IllegalStateException: The configuration of the pool is sealed once started.
Use HikariConfigMXBean for runtime changes.]
我正在使用 slf4j 而不是 log4j 作为日志记录框架,当我删除 sleuth 依赖项时应用程序运行正常。
我注意到当包含 spring-cloud 依赖项时,会出现以下 'additional' 属性源。
env.MutablePropertySources (MutablePropertySources.java:106) - Adding PropertySource 'springCloudClientHostInfo' with lowest search precedence
env.MutablePropertySources (MutablePropertySources.java:106) - Adding PropertySource 'defaultProperties' with lowest search precedence
env.MutablePropertySources (MutablePropertySources.java:106) - Adding PropertySource 'Management Server' with lowest search precedence
经常检查最新的发布系列是否不能解决您的问题。老实说,我真的不知道哪个问题与这个问题有关:/ Edgware release train is compatible with Boot < 2.0