Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What kind of pit will be encountered after upgrading Spring Cloud to Finchley?

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you the "upgrade Spring Cloud to Finchley will encounter after the pit", the content is easy to understand, clear, hope to help you solve the doubt, the following let the editor lead you to study and learn "upgrade Spring Cloud to Finchley what will be encountered after the pit" this article.

Recently, in order to use Kotlin and Webflux for background application development, the Spring Cloud version has been upgraded to Finchley.

This large version of the promotion, of course, the pit is inevitable, I will recently sum up the problems encountered here to avoid spending too much time on the pit:

Failed to bind properties under 'eureka.instance.instance-id' to java.lang.String:

Description:

Failed to bind properties under 'eureka.instance.instance-id' to java.lang.String:

Property: eureka.instance.instance-id

Value: ${spring.cloud.client.ipAddress}: ${spring.application.name}: ${spring.application.instance_id:$ {server.port}}

Origin: "eureka.instance.instance-id" from property source "bootstrapProperties"

Reason: Could not resolve placeholder 'spring.cloud.client.ipAddress' in value "${spring.cloud.client.ipAddress}: ${spring.application.name}: ${spring.application.instance_id:$ {server.port}}"

The parameter spring.cloud.client.ipAddress can no longer be recognized.

Let's look at the source code:

# org.springframework.cloud.client.HostInfoEnvironmentPostProcessor@Override public void postProcessEnvironment (ConfigurableEnvironment environment, SpringApplication application) {InetUtils.HostInfo hostInfo = getFirstNonLoopbackHostInfo (environment); LinkedHashMap map = new LinkedHashMap (); map.put ("spring.cloud.client.hostname", hostInfo.getHostname ()); map.put ("spring.cloud.client.ip-address", hostInfo.getIpAddress ()); MapPropertySource propertySource = new MapPropertySource ("springCloudClientHostInfo", map); environment.getPropertySources (). AddLast (propertySource);}

If we find that the original ipAddress has been changed to ip-address, then we can make corresponding corrections in the configuration center.

Note: changing to ip-address will not affect the previous version of the project, and will automatically parse and assign values correctly

The above is all the contents of this article entitled "what will happen after upgrading Spring Cloud to Finchley". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 270

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report