問題
程序出錯:Configuration property name ‘xxx’ is not valid, Canonical names should be kebab-case (‘-‘ separated), lowercase alpha-numeric characters and must start with a letter。post
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.
|
解決
緣由是命名不規範,不要大寫字母,使用小寫字母,可加中劃線-。ui
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, 對應配置文件也作相應調整便可。code
https://blog.gelu.me/2018/Configuration-property-name-%27xxx%27-is-not-valid/