Ниже представлена часть файла сборки, которая ссылается на 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 для ведения журнала, и приложение работает нормально, когда я удаляю зависимость сыщика.
Я заметил, что следующие 'дополнительные' источники свойств присутствуют, когда включена зависимость spring-cloud.
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
Dalston.SR5
очень старый. Пожалуйста, обновитесь доEdgware.SR3
и посмотрите, сохраняется ли проблема. - person Marcin Grzejszczak   schedule 03.04.2018