问题是
PropertySource仅支持属性文件,您无法从
yml文件读取值。您可以像这样更新它:
@Component@ConfigurationProperties("acme")@PropertySource("classpath:/configuration/yml/test.properties")class AcmeProperties {配置/ yml / test.properties
acme.list[0].name=my nameacme.list[0].description=my descriptionacme.list[1].name=another nameacme.list[1].description=another description
和代码应该工作。



