I want to read this configuration YAML from Spring Boot:
host:
api1: http://api1.com
api2: http://api2.com
api3: http://api3.com
into a Map and let it create a new Object so that it looks like this:
def apiUrls = ["api1":new Api("http://api1.com"),
"api2":new Api("http://api2.com"),
"api3":new Api("http://api3.com")]
I've already tried several solutions from Stack Overflow (e.g. this), but the result was always an empty map. The variables are definitely loaded (they are present in /management/env).
Does anyone know how to do it in Groovy?