spring boot启动报错:Reason: Canonical names should be kebab-case (‘-‘ separated), lowercase

spring boot启动之后报错:
Description:

Configuration property name 'dataSource' is not valid:

    Invalid characters: 'S'
    Bean: myDateSource
    Reason: Canonical names should be kebab-case ('-' separated), lowercase alpha-numeric characters and must start with a letter

Action:

Modify 'dataSource' so that it conforms to the canonical names requirements.

这里是我在测试加载yml配置文件时报的错误,本想将yml中的对象数据封装成一个类,结果发现如下错误:
在这里插入图片描述
通过检查之后发现是由于springboot 2.x的版本中对配置文件中的命名规范有了强制性的要求,如下图所示中的dataSource属性属于驼峰格式,但是在springboot 2.x中不允许使用驼峰形式。
在这里插入图片描述
根据错误提示可知将其使用 “-” 来分割即可。

猜你喜欢

转载自blog.csdn.net/xiaoning9299/article/details/123993402
今日推荐