Failed to bind properties under 'limit.description' to java.math.BigDecimal:
Property: limit.description
Value: 最少发${limit.minMoney}元红包,最多发${limit.maxMoney}元红包
Origin: class path resource [application.yml] - 4:16
Reason: failed to convert java.lang.String to java.math.BigDecimal
Action:
Update your application's configuration
//注意description是字符串,不是BigDecimal
package com.imooc.luckymoney;
import java.math.BigDecimal;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "limit")
public class LimitConfig {
private BigDecimal minMoney;
private BigDecimal maxMoney;
private String description;
public BigDecimal getMinMoney() {
return minMoney;
}
public void setMinMoney(BigDecimal minMoney) {
this.minMoney = minMoney;
}
public BigDecimal getMaxMoney() {
return maxMoney;
}
public void setMaxMoney(BigDecimal maxMoney) {
this.maxMoney = maxMoney;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}