yml文件
girl:
cupSize: B
age: 18
GirlProperties 类
@ConfigurationProperties(prefix = "girl",locations = "application.yml")
public class GirlProperties {
private String cupSize;
private Integer age;
public String getCupSize() {
return cupSize;
}
public void setCupSize(String cupSize) {
this.cupSize = cupSize;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
错误信息
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-12-12 23:35:53.086 ERROR 4108 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field GirlProperties in cn.bdqn.girl.HelloController required a bean of type 'cn.bdqn.girl.GirlProperties' that could not be found.
Action:
Consider defining a bean of type 'cn.bdqn.girl.GirlProperties' in your configuration.
慕粉2109029135
拖鞋_
相关分类