简体   繁体   English

找不到能够从类型 [java.util.LinkedHashMap 进行转换的转换器<?, ?> ] 输入 [java.lang.String] - Spring 配置服务器

[英]No converter found capable of converting from type [java.util.LinkedHashMap<?, ?>] to type [java.lang.String] - Spring config server

we're using spring config server for environment specific properties and it was working fine.我们将 spring 配置服务器用于特定于环境的属性,并且运行良好。 All of a sudden without any change (or not able to identify what changed), spring boot application unable to start.突然没有任何变化(或无法识别发生了什么变化),spring boot应用程序无法启动。

After enabling trace logs, spring config server values is resolved as LinkedHashMap instead of String.启用跟踪日志后,spring 配置服务器值被解析为 LinkedHashMap 而不是 String。

For example, if the property is,例如,如果属性是,

influx.db.username = username influx.db.username = 用户名

This username value supposed to resolved as String.这个用户名值应该解析为字符串。 But in the trace logs,但是在跟踪日志中,

     **Found key 'influx.db.username' in PropertySource 'bootstrapProperties' with value of type LinkedHashMap**
2019-Dec-04 08:34:38 AM [main] [] TRACE o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'influx.db.port' in PropertySource 'bootstrapProperties'
2019-Dec-04 08:34:38 AM [main] [] TRACE o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'influx.db.port' in PropertySource 'servletConfigInitParams'
2019-Dec-04 08:34:38 AM [main] [] TRACE o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'influx.db.port' in PropertySource 'servletContextInitParams'
2019-Dec-04 08:34:38 AM [main] [] TRACE o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'influx.db.port' in PropertySource 'systemProperties'
2019-Dec-04 08:34:38 AM [main] [] TRACE o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'influx.db.port' in PropertySource 'systemEnvironment'
2019-Dec-04 08:34:38 AM [main] [] TRACE o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'influx.db.port' in PropertySource 'random'
2019-Dec-04 08:34:38 AM [main] [] TRACE o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'influx.db.port' in PropertySource 'applicationConfigurationProperties'

From the logs, it is clear that the value type resolved as type of Map.从日志中可以清楚地看出,值类型解析为 Map 类型。

Where I can change the return type of this value ?我可以在哪里更改此值的返回类型?

Solved the issue by bumping to older version of our spring-cloud-config-server docker image.通过跳转到我们的 spring-cloud-config-server docker 镜像的旧版本解决了这个问题。

registry.hub.docker.com/hyness/spring-cloud-config-server:2.1.4.RELEASE registry.hub.docker.com/hyness/spring-cloud-config-server:2.1.4.RELEASE

We were using docker image from https://github.com/hyness/spring-cloud-config-server .我们使用来自https://github.com/hyness/spring-cloud-config-server 的docker 镜像。 Apparently, the recent changes in the Spring version upgrade break this issue.显然,最近 Spring 版本升级的变化打破了这个问题。

And looks like this issue related to existing open issue with spring config server.看起来这个问题与 spring 配置服务器的现有开放问题有关。 https://github.com/spring-cloud/spring-cloud-config/issues/1515 https://github.com/spring-cloud/spring-cloud-config/issues/1515

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到能够从类型 [java.util.LinkedHashMap 进行转换的转换器<?, ?> ] 输入 - No converter found capable of converting from type [java.util.LinkedHashMap<?, ?>] to type MongoDB 找不到能够从 [java.lang.String] 类型转换为 [java.time.LocalDateTime] 类型的转换器 - MongoDB No converter found capable of converting from type [java.lang.String] to type [java.time.LocalDateTime] Spring MVC“找不到能够将java.lang.String类型转换为org.springframework.core.io.Resource类型的转换器” - Spring MVC “No converter found capable of converting from type java.lang.String to type org.springframework.core.io.Resource” 无法反序列化 `java.util.LinkedHashMap 类型的值<java.lang.string,java.lang.string> ` 来自 Array 或什么是我的字段的正确类型</java.lang.string,java.lang.string> - Cannot deserialize value of type `java.util.LinkedHashMap<java.lang.String,java.lang.String>` from Array or what would be a correct type of my field org.springframework.core.convert.ConverterNotFoundException:找不到能够从 [java.lang.String] 类型转换为 Model 类型的转换器 - org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type Model 找不到能够从 [java.lang.String] 类型转换为 [@Autowired @ManyToOne @JoinColumn com.papertrue.country.Country] 类型的转换器 - No converter found capable of converting from type [java.lang.String] to type [@Autowired @ManyToOne @JoinColumn com.papertrue.country.Country] 如果使用spring-data-rest,则找不到能够从[java.lang.String]类型转换为[com.google.cloud.datastore.Key]类型的转换器错误 - No converter found capable of converting from type [java.lang.String] to type [com.google.cloud.datastore.Key] error if spring-data-rest is used class java.util.LinkedHashMap cannot be cast to class java.lang.String (java.util.LinkedHashMap and java.lang.String - class java.util.LinkedHashMap cannot be cast to class java.lang.String (java.util.LinkedHashMap and java.lang.String 找不到能够从类型 [java.time.LocalDate] 转换为类型 [@org.springframework.data.jpa.repository.Query java.lang.String] 的转换器 - No converter found capable of converting from type [java.time.LocalDate] to type [@org.springframework.data.jpa.repository.Query java.lang.String] 春季启动2:ConverterNotFoundException:未找到能够从类型[java.time.ZonedDateTime]转换为类型[java.util.Date]的转换器 - Spring boot 2 : ConverterNotFoundException: No converter found capable of converting from type [java.time.ZonedDateTime] to type [java.util.Date]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM