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

Springboot集成Nacos配置中心报错 #328

Open
shining-stars-lk opened this issue Apr 7, 2024 · 1 comment
Open

Springboot集成Nacos配置中心报错 #328

shining-stars-lk opened this issue Apr 7, 2024 · 1 comment

Comments

@shining-stars-lk
Copy link

版本

  • SpringBoot:2.5.2
  • Nacos:0.2.5

引入的Nacos依赖:

<dependency>
    <groupId>com.alibaba.boot</groupId>
    <artifactId>nacos-config-spring-boot-starter</artifactId>
    <version>0.2.5</version>
</dependency>

读取的相关配置

nacos:
  config:
    bootstrap:
      enable: true
    server-addr: xxx:8848
    data-id: web-mdt.yaml
    namespace: xxx
    group: mdt_group
    type: yaml
    auto-refresh: true
    username: nacos
    password: nacos
    ext-config:
      - server-addr: xxx:8848
        data-id: web-mdt-company.yaml
        namespace: xxx
        group: mdt_group
        type: yaml
        auto-refresh: true
        username: nacos
        password: nacos

出现的错误

在项目启动时,出现了类找不到错误

web- 2024-04-07 13:51:15 [restartedMain] ERROR
                o.s.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nacosConfigurationPropertiesBinder': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.alibaba.boot.nacos.config.binder.NacosBootConfigurationPropertiesBinder]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata

这是什么原因?

@fishandsheep
Copy link

版本不兼容,建议降低SpringBoot的版本至2.4以下,或者升级Nacos的版本至0.2.12
alibaba/nacos#4554
#159

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

No branches or pull requests

2 participants