vert-x3 / vertx-config

Vert.x Configuration Service
Apache License 2.0
54 stars 64 forks source link

Spring Config Server: wrong overriding order #54

Closed jpiecuch closed 6 years ago

jpiecuch commented 6 years ago

I've recently used lib for obtaining configuration from Spring Config Server and I think that there is critical bug in there. Basically properties overriding order is wrong. Spring uses order described here https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html.

Spring Config Server when calling for configuration returns collection of propertySources in descending order (most relevant first). In your code you are merging those sources but in the way that properties from the next source override those from previous.

I've fixed this issue for my local development so if you need more clarification I can provide code snippet or even pull request.

cescoffier commented 6 years ago

Hi, nice catch. A PR would be great!

jpiecuch commented 6 years ago

Awesome, one other thing. Spring provide functionality to expose configuration in JSON format by calling URI /{application}-{profile}.json. By default it also resolves Spring specific placeholders (it can be disabled by provding parameter resolvePlaceholder=false). It's explained here: https://cloud.spring.io/spring-cloud-config/multi/multi__serving_alternative_formats.html. I believe it would be significant improvement if vert.x would be able to consume those additional format.

Do you think it's worth to add this functionality to PR too?

cescoffier commented 6 years ago

Yes, definitely!

jpiecuch commented 6 years ago

PR ready. https://github.com/vert-x3/vertx-config/pull/55

jpiecuch commented 6 years ago

Problem solved.