目录
  1. 问题
  2. 解决

问题

程序出错:Configuration property name ‘xxx’ is not valid, Canonical names should be kebab-case (‘-‘ separated), lowercase alpha-numeric characters and must start with a letter。

1
2
3
4
5
6
7
8
9
Configuration property name 'cmsOss' is not valid:
 
Invalid characters: 'O'
Bean: CMSImageController
Reason: Canonical names should be kebab-case ('-' separated), lowercase alpha-numeric characters and must start with a letter
 
Action:
 
Modify 'cmsOss' so that it conforms to the canonical names requirements.

解决

原因是命名不规范,不要大写字母,使用小写字母,可加中划线-。

1
2
3
4
5
6
7
8
9
10
11
12
@Data
@Component
@ConfigurationProperties(prefix = "cmsOss")
public class CMSOSSConfig {
private String accessId;
 
private String accessKey;
 
private String endpoint;
 
private String bucket;
}

将cmsOss改成cms-oss, 对应配置文件也做相应调整即可。

 
 https://blog.gelu.me/2018/Configuration-property-name-%27xxx%27-is-not-valid/

相关文章:

  • 2021-12-16
  • 2022-12-23
  • 2021-10-31
  • 2021-11-18
  • 2021-09-17
  • 2022-12-23
  • 2021-07-26
  • 2021-07-05
猜你喜欢
  • 2022-12-23
  • 2021-06-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
相关资源
相似解决方案