yml 键值的大小写约束与自定义内容提示 porm.xml 配置
在配置阿里云OSS时,由于配置文件中的属性名Aliyun.OSS包含大写字母,导致应用程序启动失败。根据错误提示,配置属性名应遵循kebab-case格式,即使用小写字母和连字符分隔。因此,需要将Aliyun.OSS修改为aliyun.oss,以确保符合规范。具体修改包括将Aliyun:OSS:改为aliyun:oss:,并在@ConfigurationProperties注解中将prefix=&
idea 礼貌的报错了
当前的配置文件信息
# Aliyun OSS 配置
Aliyun:
OSS:
endpoint: https://oss-cn-beijing.aliyuncs.com
bucketName: javawebdev
region: cn-beijing
以及
// AliyunOSSProperties.class
@Data
@Component
@ConfigurationProperties(prefix = "Aliyun.OSS")
public class AliyunOSSProperties {
private String endpoint;
private String bucketName;
private String region;
}
修改了 Aliyun 之后,运行依旧报错,提示
***************************
APPLICATION FAILED TO START
***************************Description:
Configuration property name 'aliyun.OSS' is not valid:
Invalid characters: 'O', 'S', 'S'
Bean: uploadFileController
Reason: Canonical names should be kebab-case ('-' separated), lowercase alpha-numeric characters and must start with a letterAction:
Modify 'aliyun.OSS' so that it conforms to the canonical names requirements.
需要修改 OSS 。
yml and yaml 文件的标签 不允许大写。小写与“-”分割,是正确的做法。
Canonical names should be kebab-case ('-' separated), lowercase alpha-numeric characters and must start with a letter
配置自定义内容的提示
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐
所有评论(0)