Skip to content

spring.application.name has no effect when set as an environment variable in 2022.0.3 #2274

@westmc

Description

@westmc

We upgraded from 2022.0.2 to 2022.0.3 and our Spring Cloud Config clients no longer seem to work.

2022.0.2

2023-05-31T15:57:45.777-07:00  INFO 22800 --- [  restartedMain] org.example.ConfigTestApplication        : The following 1 profile is active: "dev"
2023-05-31T15:57:45.823-07:00  INFO 22800 --- [  restartedMain] o.s.c.c.c.ConfigServerConfigDataLoader   : Fetching config from server at : http://XXXX
2023-05-31T15:57:45.823-07:00  INFO 22800 --- [  restartedMain] o.s.c.c.c.ConfigServerConfigDataLoader   : Located environment: name=notification-service, profiles=[dev], label=null, version=baa976431f5c111b2bed9a8b7643212c5f302f9e, state=null
2023-05-31T15:57:45.824-07:00 DEBUG 22800 --- [  restartedMain] o.s.c.c.c.ConfigServerConfigDataLoader   : Environment notification-service has 1 property sources with 18 properties.

2022.0.3

2023-05-31T15:55:45.211-07:00  INFO 32892 --- [  restartedMain] org.example.ConfigTestApplication        : The following 1 profile is active: "dev"
2023-05-31T15:55:45.249-07:00  INFO 32892 --- [  restartedMain] o.s.c.c.c.ConfigServerConfigDataLoader   : Fetching config from server at : http://XXXX
2023-05-31T15:55:45.250-07:00  INFO 32892 --- [  restartedMain] o.s.c.c.c.ConfigServerConfigDataLoader   : Located environment: name=application, profiles=[default], label=null, version=baa976431f5c111b2bed9a8b7643212c5f302f9e, state=null
2023-05-31T15:55:45.250-07:00 DEBUG 32892 --- [  restartedMain] o.s.c.c.c.ConfigServerConfigDataLoader   : Environment application has 0 property sources with 0 properties.
2023-05-31T15:55:45.250-07:00  INFO 32892 --- [  restartedMain] o.s.c.c.c.ConfigServerConfigDataLoader   : Fetching config from server at : http://XXXX
2023-05-31T15:55:45.250-07:00  INFO 32892 --- [  restartedMain] o.s.c.c.c.ConfigServerConfigDataLoader   : Located environment: name=application, profiles=[dev], label=null, version=baa976431f5c111b2bed9a8b7643212c5f302f9e, state=null
2023-05-31T15:55:45.250-07:00 DEBUG 32892 --- [  restartedMain] o.s.c.c.c.ConfigServerConfigDataLoader   : Environment application has 0 property sources with 0 properties.
2023-05-31T15:55:45.250-07:00  INFO 32892 --- [  restartedMain] o.s.c.c.c.ConfigServerConfigDataLoader   : Fetching config from server at : http://XXXX
2023-05-31T15:55:45.250-07:00  INFO 32892 --- [  restartedMain] o.s.c.c.c.ConfigServerConfigDataLoader   : Located environment: name=application, profiles=[default], label=null, version=baa976431f5c111b2bed9a8b7643212c5f302f9e, state=null
2023-05-31T15:55:45.250-07:00 DEBUG 32892 --- [  restartedMain] o.s.c.c.c.ConfigServerConfigDataLoader   : Environment application has 0 property sources with 0 properties.

I didn't drill down too deeply in the code, but I do see that it is definitely passing in "application" to the restTemplate in ConfigServerConfigDataLoader instead of the value from spring.application.name ("notification-service").

This was tested against Spring Boot 3.0.7.

The profile and server uri are being passed through env variables

SPRING_PROFILES_ACTIVE=dev
spring.config.import=configserver:http://u:p@XXXX

We have no additional config. I created a dummy project to reproduce this, but unless I am missing something, this seems to be fundamentally broken. I didn't see any required config changes in the release notes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions