• Map<String, String>

application.properties:

simple.map={ 'key1': 'value1', 'key2': 'value2' }

Spring Bean Java Class:

@Value("#{${simple.map}}")
private Map<String, String> simpleMap;


  • Map<String, Map<String, String>

application.properties:

complex.map={\
  'key1': {\
    'subKey1': 'subValue1',\
    'subKey2': 'subValue2'\
  },\
  'key2': {\
    'subKey3': 'subValue3',\
    'subKey4': 'subValue4'\
  },\
  'key3': {\
    'subKey5': 'subValue5',\
    'subKey6': 'subValue6'\
  }\
}

Spring Bean Java Class:

@Value("#{${complex.map}}")
private Map<String, Map<String, String>> complexMap;