I have two properties in the Application Properties. One of them has a dash. the other has no dash in its name. Both properties are registered. However, when i resolve the property, the value of the property without the dash is always returned.

application.properties

it.is.an.evil-dash.ok=greetings
it.is.an.evildash.ok=greetings2
env.getProperty("it.is.an.evil-dash.ok"); // returns greetings2 (wrong)
env.getProperty("it.is.an.evildash.ok"); // returns greetings2 (ok)

Additional Information:

  • Spring Boot version: [3.1.5] / [2.7.16]

Please let me know if you need further information or if this behaviour is explicitly desired.

Comment From: philwebb

This is actually working as designed. Due to relaxed binding it.is.an.evil-dash.ok and it.is.an.evildash.ok are treated the same. Property files follow the same order principles as external files where entries lower in the file replace earlier ones. In your example, greetings2 is always used because it is below greetings.

Comment From: safebees

Thank you for your answer and sorry for the interruption. In my case the property without dash is always preferred no matter in which order. But for me its ok. For all who run into the same problem: intellij has a "stricter" "wrong" resolution of the properties in the preview.

SpringBoot property is resolved incorrectly in case of a dash