注册nacos失败,No service to register for nacos client,No spring.application.name found, defaulting to

WARN 7728 --- [           main] o.s.c.n.a.ArchaiusAutoConfiguration      : No spring.application.name found, defaulting to 'application'
 WARN 7728 --- [           main] c.a.c.n.registry.NacosServiceRegistry    : No service to register for nacos client...

注册nacos失败,查看日志发现提示:No spring.application.name found,但是配置文件明明正确配置了。

排查步骤:

  1. 查看target目录下是否存在配置文件切配置正确
  2. 我发现我的tagert下配置文件不存在
  3. 查看pom发现resource配置有问题导致,把**/*.yml加上即可,下面的配置看自己情况添加
<resources>
            <!--配置打包时字体文件不被maven拷贝,导致字体文件破坏-->
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.properties
                    **/*.yml</include>
                    <include>**/*.html
                    **/*.js</include>
                    <include>**/*.css
                    **/*.xml</include>
                </includes>
                <excludes>
                    <exclude>**/*.ttf
                    **/*.woff</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <includes>
                    <include>**/*.ttf
                    **/*.woff</include>
                </includes>
            </resource>
        </resources>

你可能感兴趣的:(开发问题记录,spring,java,maven)