After reading a couple of answers on StackOverflow, I tried to implement it as recommended, but I am still not getting a string list in my @Component
.
Here is my application.yml
file
appName:
db:
host: localhost
username: userX
password: passX
driverClassName: org.postgresql.Driver
shipment:
providers:
supported:
- one
- two
And my @Component
class is
@Component
@ConfigurationProperties(prefix = "appName.shipment.providers")
public class ProviderUtil {
List<String> supported;
/* This class has other util methods as well */
}
Here, I expect that supported
would have a list of strings one
and two
but is null
. Can someone help me understand what is happening here and how to resolve it?