SpringCloud+gateway+nacos整合踩过的坑
第一:构建项目时
版本!版本!版本!spring版本! Nacos Requires SpringBoot Version >=2.2.0.RELEASE and <2.3.0.M1
第二:配置时–Nacos
要用bootstrap.yml文件,不然会默认加载本地Nacos.修改后删除target目录后再启动即可
第三:单机跑3个服务
首先复制3个相同的bootstrap文件,为什么是bootstrap?nacos默认会先加载bootstrap文件。
其中只需要改写port(端口号)
启动设置中只需要写破折号后面的名称,没有破折号则不需要填写。注意!!!必须是破折号分类,不然会找不到。然后分开启动即可
application.name 的名称必须相同,nacos注册服务是根据name来注册的,名称相同会注册进同一个服务