SpringBoot自定义读取properties Configuration property name 'configuration.airPortproperties' is not valid

版权声明:本文为博主原创文章,未经博主允许不得转载,如需帮助请qq联系1016258579,或者关注公众号 程序员日常锦集 ” 。 https://blog.csdn.net/weixin_38361347/article/details/88288502

Caused by: org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name ‘fairPortProperties’: Could not bind properties to ‘airPortProperties’ : prefix=configuration.airPort.properties, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is org.springframework.boot.context.properties.source.InvalidConfigurationPropertyNameException: Configuration property name ‘configuration.airPortproperties’ is not valid
at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind

我的springboot 版本 2.1.0

查看文档后了解到
springboot1.5以下版本貌似不存在这种问题

@ConfigurationProperties(prefix = “fairport”)
注解读取application.yml文件中的系统参数时,不能有大写字母改为“fairPort”即可,不能有驼峰命名。只能小写。

猜你喜欢

转载自blog.csdn.net/weixin_38361347/article/details/88288502