admin管理员组文章数量:1122846
I have a structure as below:
company:
employees:
- name:
age:
- name:
age:
I have to have this structure in ConfigMap
which has key, value pairs. Then I have to read this into a List<Employee>
where Employees is a POJO having name and age as fields. We also have @ConfigurationProperties(prefix = "company")
as class level annotation.
Can I achieve this? Please advise.
@ConfigurationProperties(prefix = "company")
class ABC {
List<Employee> employees;
// .....
}
class Employee {
String name;
String age;
}
But the basic issue is ConfigMap
has unique keys. How do I store arrays in ConfigMap
and then map like above.
What I expect is that the arrays of employee map to the POJO.
本文标签: spring bootHow do i read an array of values from yaml file to a ListltPOJOgt in JavaStack Overflow
版权声明:本文标题:spring boot - How do i read an array of values from yaml file to a List<POJO> in Java - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736302980a1931726.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论