Conflict between LEAF and MAP after upgrading spring-cloud-config-server

Viewed 160

I'm using spring-cloud-config-server 1.2.2..RELEASE.

I need to update it to a newer version (e.g. 1.4.4..RELEASE, but the issue happens in the latest version as well)). When I tried to update the version and performed a call to the YAML endpoint of the config server (with test profile requested), I got an error (ClassCastException: java.lang.String cannot be cast to java.util.Map) on some of my properties.

These properties are defined in application.yaml as a LEAF:

logging.level.com.company: DEBUG

But are defined as MAP on my application specific profile YAML (application-test.yaml):

logging.level.com.company.salesforce.editor.service: DEBUG

Previously, I got in the response YAML something like:

logging:
    level:
        com:
            company: DEBUG
            company.salesforce.editor.service: DEBUG
  • I debugged the spring-cloud-config-server code I found out there was a major change (from 1.2.x to 1.3.x) in EnvironmentController.java\convertToMap(Environment input, boolean resolvePlaceholders)() that probably caused it.

  • I found this GitHub issue on a similar issue: ClassCastException with specific logging settings But it wasn't helpful to me.

How can I use the new version, but get the same response as in the old version? If not possible, what is another course of action I can take?

EDIT

I've created a demo project to illustrate the problem - Clone it from here:

spring-cloud-config-server-demo

(It uses the following git backend for configurations: spring-cloud-config-server-configurations)

Once the demo server is up and running, query it like so:

curl http://localhost:8080/master/application-test.yaml

and you will get this error:

java.lang.String cannot be cast to java.util.Map
0 Answers
Related