Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

遭遇Canonical names should be kebab-case ('-' separated) #17

Open
starlight36 opened this issue Feb 7, 2020 · 0 comments
Open

遭遇Canonical names should be kebab-case ('-' separated) #17

starlight36 opened this issue Feb 7, 2020 · 0 comments

Comments

@starlight36
Copy link

Hi~

我在Spring Boot 2.1下使用这个组件时遇到个问题:

***************************
APPLICATION FAILED TO START
***************************

Description:

Configuration property name 'spring.datasource.druid.data-sources.commonMaster' is not valid:

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

Action:

Modify 'spring.datasource.druid.data-sources.commonMaster' so that it conforms to the canonical names requirements.

提示属性名格式不正确。确认了一下yml里面写的,的确是小写中横线格式的:

spring:
  datasource:
    druid:
      data-sources:
         common-master:
...

跟了一下,是初始化数据源对象时候,bind属性操作使用的beanName拼接,而非最初配置使用的key:

Binder.get(environment).bind(PREFIX + "." + beanName, Bindable.ofInstance(druidDataSource));

所以这里要么想办法把先前的key传过来,要么再做一次驼峰转小写中横线😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants