Skip to content

Throwing an exception on invalid syntax in SPRING_APPLICATION_JSON #14239

@pvorb

Description

@pvorb

As far as I can tell, Spring Boot 2 accepts syntax errors in the SPRING_APPLICATION_JSON environment variable and silently ignores the whole content of the environment variable. This leads to problems that are hard to debug, where properties are not overridden when running an application.

Consider the following example.

application.yml:

parentKey:
    childKey: true

SPRING_APPLICATION_JSON:

{"parentKey" {"childKey": false}}

(Note the missing colon after "parentKey".)

If you now try to inject the value via @Value or a @ConfigurationProperties class, you get true instead of false.

In my opinion it would be better to throw an exception and abort application startup in this case or at least to log an error or warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by another

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions