I have multiple host values according to different markets how to fetch all those in spring-boot to create a bean. I have tried with
@value("#{${app.host}}")
private String[] host;
consul values
app:
host:
hostone: 'localhost:8080'
hosttwo: 'abc:8089'
You can obtain an array whit the following annotation
but your yml should be
or you can get
and keep your YML file as-is.