谷粒商城nacos远程配置中心出错

首先检查配置文件是否正确创建

image-20210514122028253

application.yml ,application.properties 最好不要有中文,有中文注释也不行。

yml文件格式容易出错。 确定其他没有错之后,最后解决方法 删除重新建立一个

nacos中心配置文件建立要正确

image-20210514122527067

如果还是报错,检查你的springcloud版本和springboot版本

coupon模块中引入的依赖

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Greenwich.SR3</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.8.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

在common中是否引入了对应的依赖

<!--        nacos的配置中心-->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
        </dependency>

    <dependencyManagement>
        <dependencies>
<!--            springcloud版本依赖-->
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>2.1.0.RELEASE</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
posted @ 2021-05-14 12:42  Cherish°  阅读(294)  评论(0编辑  收藏  举报