spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.02k stars 40.65k forks source link

application.yml property maps no longer work #12606

Closed jbauman51 closed 6 years ago

jbauman51 commented 6 years ago

I used to be able to configure a mapping in application.yml like this (springboot 1.5.10.RELEASE):

cachesByTopic:
  "Admin/1/D/DataStream/Stream1/*/*/*": Cache_Admin
  "Admin/1/D/DataStream/Stream2/*/*/*": Cache_Admin
  "Admin/1/D/DataStream/Stream1/*/*": Cache_Admin
  "Admin/1/D/DataStream/Stream2/*/*": Cache_Admin

and it would create a LinkedHashMap with entries like this:

("Admin/1/D/DataStream/Stream1/*/*/*", Cache_Admin)
("Admin/1/D/DataStream/Stream2/*/*/*", Cache_Admin)
("Admin/1/D/DataStream/Stream1/*/*", Cache_Admin)
("Admin/1/D/DataStream/Stream2/*/*", Cache_Admin)

now in 2.0.0.RELEASE, the same application.yml mapping produces LinkedHashMap with entries like this:

("Admin1DDataStreamStream1", Cache_Admin)
("Admin1DDataStreamStream2", Cache_Admin)
mbhave commented 6 years ago

@jbauman51 the new properties binder strips off all characters that are not alphanumeric or - so that properties can be read in a uniform manner. For map keys that have special characters in them, you can surround the key name with [] so that the key gets used as specified, for example, [Admin/1/D/DataStream/Stream1/*/*/*]. See the Relaxed binding rules in 2.0.