- 类
@Component
@ConfigurationProperties(prefix = "order")
@Data
public class OrderDto {
private String orderId;
private String orderPrice;
@Value("${amount}")
private BigDecimal orderAmount;
@Value("#{'${order.user.list}'.split(',')}")
private List<String> users;
private List<Msg> msgs;
@Data
public static class Msg{
private String name;
private Integer age;
}
}
- properties
order.orderId="00100"
order.orderPrice=20.78
order.msgs[0].name=zs
order.msgs[0].age=1
order.msgs[1].name=ls
order.msgs[1].age=2
amount=30
order.user.list=zs,ls,ww