I have application.properties file which contains Map values like below,
myMap={key1:'value1',key2:'value2',....}
Now I know I can read this using,
@Value("#{${myMap}}")
private Map<String,String> myMap;
But I want to read this using Environment API. But I don't see proper method to fetch the Map value as Map. All I see is
import org.springframework.core.env.Environment;
@Autowired
private Environment env;
Map<String,String> myMap = env.getProperty("myMap"); // returns String
How can I get a Map directly from the properties file using the Enviromnet API? Or I need to do conversions on my own?
Any help is appreciated.