Gateway一直访问本地

配置文件中配了远程nacos服务的地址,但是一启gateway项目就连本地:

2021-03-07 10:06:58.431  INFO 8388 --- [           main] c.a.n.c.c.impl.LocalConfigInfoProcessor  : LOCAL_SNAPSHOT_PATH:C:\Users\l22966\nacos\config
2021-03-07 10:06:58.456  INFO 8388 --- [           main] c.a.nacos.client.config.impl.Limiter     : limitTime:5.0
2021-03-07 10:06:59.478 ERROR 8388 --- [           main] c.a.n.c.config.http.ServerHttpAgent      : [NACOS SocketTimeoutException httpGet] currentServerAddr:http://localhost:8848, err : connect timed out
2021-03-07 10:07:00.479 ERROR 8388 --- [           main] c.a.n.c.config.http.ServerHttpAgent      : [NACOS SocketTimeoutException httpGet] currentServerAddr:http://localhost:8848, err : connect timed out
2021-03-07 10:07:01.480 ERROR 8388 --- [           main] c.a.n.c.config.http.ServerHttpAgent      : [NACOS SocketTimeoutException httpGet] currentServerAddr:http://localhost:8848, err : connect timed out

考虑可能是idea的bug,重启电脑,无果,故不是缓存问题。考虑可能是没有读到配置文件,所以默认访问了localhost。

然后看了眼target文件,居然没有properties文件??删掉target文件夹重新编译,还是没有,说明resources里的文件就没打包进target。

在pom文件里加入以下配置:

<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <includes>
                <include>**/*.*</include>
            </includes>
            <filtering>false</filtering>
        </resource>
    </resources>
</build>

重新打包,看到target里有配置文件了,重启项目,问题解决。

还不行的话…试试把这个build放到靠前的位置=.= 我也不知道为什么

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值