2

I have a property that looks like:

@Value(...)
Map<String, List<String>> classToMethods;

I want to populate this map via my application.yml in a Spring Boot application via the @Value("...") annotation. Some sample values are:

"java.lang.Double" => ["parseDouble", "toString"]
"java.lang.String" => ["toUpperCase"]

How do I represent this in my application.yml file? Also, I would like to put placeholder for environmentally injected values from our deployment tool. So for example, I currently have:

some:
   property: ${ENV_VALUE:default_value_if_no_env}

Basically, this is the syntax I use for injecting values for the specific environment(value for ENV_VALUE varies for each environment). I am looking for a way to format the YML map such that this kind of environment replacements are also possible.

Alternative I am thinking of is just creating a String and manually parsing it during constructor injection but would like to avoid if possible.

HelloWorld
  • 109
  • 2
  • 9

0 Answers0