I need to bind a list of POJO by yaml properties file but I was no luck to get it work.
My application.yml
has the following lines:
printer:
printers:
- deviceNo: abc
key: 123
And PrinterProperties
like this:
@Component
@ConfigurationProperties(prefix = "printer")
class PrinterProperties {
var printers: List<Printer> = listOf()
}
But the field printers
was not poputated with the application.yml
value.
There was a samilar problem
I pushed a demo to a github repository to demostrate this problem.