
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 Nov 29, 2022 ``` 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 Nov 29, 2022 可以考虑这么一个结构,耦合性强了一些,但是处理起来比较方便: name: '', binder1: {}, binder2: {}, binder3: {} |
4 goalidea Nov 29, 2022 写好 readme.md 比 ide 提示强 |
5 zhady009 Nov 29, 2022 没生成 additional-spring-configuration-metadata.json 吧 |