I have injected properties from the map read from some .yaml in Spring Boot application the following way:
@Value("#{${app.map}}")
private Map<String, String> indexesMap = new HashMap<>();
But neither
app:
map: {Countries: 'countries.xlsx', CurrencyRates: 'rates.xlsx'}
//note values in single quotes
nor
app:
map: {Countries: "countries.xlsx", CurrencyRates: "rates.xlsx"}
(as explained at https://www.baeldung.com/spring-value-annotation)
nor
app:
map:
"[Countries]": countries.xslx
"[CurrencyRates]": rates.xlsx
(as suggested at https://stackoverflow.com/a/51751123/2566304)
works - I keep getting the message 'Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder'
At the same time this works:
@Value("#{{Countries: 'countries.xlsx', CurrencyRates: 'rates.xlsx'}}")
private Map<String, String> indexesMap = new HashMap<>();
But I'd like to externalize properties