最近在B站跟着狂神学SpringBoot,在第20集的时候碰上了给Map<String, List<Pet>> allPets这个变量绑定数据,用不同格式试了好多遍都出错,求大牛解答。(附Pet类和出错信息)
package com.atguigu.boot.bean;
//Pet类
public class Pet {
private String name;
private Double weight;
}
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-03-03 22:19:22.868 ERROR 2660 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Binding to target [Bindable@622d40d7 type = java.util.List<com.atguigu.boot.bean.Pet>, value = 'none', annotations = array<Annotation>[[empty]]] failed:
Property: person.allpets.sick[0].name
Value: tom
Origin: class path resource [application.yaml] - 25:16
Reason: The elements [person.allpets.sick[0].name,person.allpets.sick[1].name,person.allpets.sick[1].weight] were left unbound.
Property: person.allpets.sick[1].name
Value: jerry
Origin: class path resource [application.yaml] - 26:16
Reason: The elements [person.allpets.sick[0].name,person.allpets.sick[1].name,person.allpets.sick[1].weight] were left unbound.
Property: person.allpets.sick[1].weight
Value: 47
Origin: class path resource [application.yaml] - 26:30
Reason: The elements [person.allpets.sick[0].name,person.allpets.sick[1].name,person.allpets.sick[1].weight] were left unbound.
Action:
Update your application's configuration