Spring boot unable to override value when original config with null value

The issue is that, when I am providing configuration from env variables, spring does not apply it to my existing config.

As in example

My config

config:
    property1: some value

and I want to add extra value to it by adding them to the env variable as

config.property2 = some extra value

The same happens in integration tests when using

@TestPropertySource(properties = {"config.property2=some value"})

Spring does not read this value, (it’s still null)

Has anyone ever had a problem with it? Is it a bug, or just Spring does not allow this?

I’ve tried debugging code and was looking into documentation. Can’t find anything.

  • 1

    config.property is generally not a proper environment variable. Use CONFIG_PROPERTY2 instead.

    – 

Leave a Comment