Skip to content

Properties read from traditional application.properties files are not trimmed #4106

@brenuart

Description

@brenuart

The property values read from traditional application.properties configuration files are not trimmed. This can lead to undesired/strange behaviours at runtime:

  • @ConditionalOnProperty annotation perform a simple equals between the expected and received value (without type conversion). A property value set to 'true ' (notice the space at the end) is likely to fail the condition
  • developers must/should trim the injected string values themselves

Not trimming values out of properties files is error prone (you can't blame a user if they forgot a blank at the end of the line - they don't see it). It may be acceptable for XML files however: value is between start/end markers so the blank is visible.

Proposition is to update the PropertiesPropertySourceLoader so it automatically trims values read from .properties files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: declinedA suggestion or change that we don't feel we should currently apply

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions