springcloud alibaba Integrating nacos reports errors: create config service error!properties=NacosConfigPropertie

Solution:

First, check whether the YML file is configured

spring:    
    cloud:
        nacos:
          discovery:
            server-addr: 127.0.0.1:8848
      application:
        name: gulimall-member

If the configuration is completed, check whether the POM file references the configuration center

        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
        </dependency>

If so, just comment it out.

Problem reason: when Nacos config is used for unified configuration management, the bootstrap.properties configuration file is used to initialize the context when starting the springboot project.

When using the unified configuration of springcloudconfig, the loading order of spring boot configuration files is bootstrap.properties – & gt; bootstrap.yml -> application.properties -> Application.yml, where bootstrap.properties is configured as the highest priority.

Therefore, an error is reported if the properties file is not found during configuration.

If you need to use the Nacos configuration center, on the premise of referencing the above dependencies, you need to add the bootstrap.properties file in the resource directory, configure the service name, Nacos address and port number, and restart the service.

spring.application.name=gulimall-coupon
spring.cloud.nacos.config.server-addr=127.0.0.1:8848

 

Read More: