/** * 只有在容器中的组件,配置绑定才生效 */@Component@ConfigurationProperties(prefix = "mycar")public class Car { private String brand; private Integer price;} 绑定配置文件中以 mycar 开头的配置application.properties mycar.brand=小米mycar.price=100