
com: github: xxx: - name: abc binder: type: aaa prop1: xxx prop2: yyy prop3: zzz - name: bcd binder: type:bbb prop4: ppp prop5: ooo prop6: iii 自定义的配置如上的结构,每个 binder 都有固定的 type 字段,下面的字段则根据 type 的值配置的,不是固定写死的,我在 ConfigurationProperties 的类里面该怎么定义 POJO ,让 yaml 能识别到并自动提示呢
1 v2wtf 2022-11-29 00:05:03 +08:00 ``` class Binder { public String type; public String xxx; public String yyy; } class Item { public String name; public Binder binder; } class MyProperties { public List<Item> items; } ``` |
3 chendy 2022-11-29 08:20:17 +08:00 可以考虑这么一个结构,耦合性强了一些,但是处理起来比较方便: name: '', binder1: {}, binder2: {}, binder3: {} |
5 zhady009 2022-11-29 12:23:39 +08:00 没生成 additional-spring-configuration-metadata.json 吧 |