Skip to content

application.properties loaded twice when using spring cloud config server #37520

@rohithkk

Description

@rohithkk

I am trying to upgrade my project from spring boot 2.7.x to 3.1.x and noticed an issue with the a config file being loaded twice.

When looking at the properties resolved using the /actuator/env endpoint, I noticed that the application.properties file is being read twice.

This is the relevant portion of /actuator/env response.


    {
        "name": "applicationConfig: [classpath:/application.properties]",
        "properties": {
            ...
        }
    },
    {
        "name": "configserver:ssh://config-server-host/application.properties",
        "properties": {
           ...
        }
    },
    {
        "name": "Config resource 'class path resource [application.properties]' via location 'optional:classpath:/'",
        "properties": {
                    ...
        }
    }

Normally I would expect the properties defined in the file deployed on cloud config server to take precedence but since the application.properties is showing up first in the list with the source as applicationConfig, those values are taking effect.

This seems to be new in 3.1. In the /actuator/env response when using Spring boot 2.7.x, I see only two entries with configserver one being the first one.

Why is the application.properties on my classpath being loaded twice? Once as applicationConfig and later as config resource?

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: external-projectFor an external project and not something we can fixstatus: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions