From config server, I want to inject the property in to my service as a Map. I can do this with @ConfigurationProperties annotation; however using the @Value (along with @RefreshScope) it reads from the config server; however throws an exception: Cannot convert value of type [java.lang.String] to required type [java.util.Map]: no matching editors or conversion strategy found
application.yml:(in config server)
user:
test:
key1:
val1,val2
key2:
val1,val2
@Service
//@ConfigurationProperties(prefix="user")
@RefreshScope
public class Example {
@Value("${user}")
Map<String, List<String>> test;
}