一、安装consul,到官网下载windows版本,双击exe文件安装
查看版本:consul --version
开发模式启动consul:consul agent -dev
consul默认端口为8500,启动后前台首页访问:http://localhost:8500
二、创建微服务
配置yml:
server:
port: 8004
spring:
application:
name: consul-provicer-payment
cloud:
consul:
host: localhost
port: 8500
discovery:
service-name: ${spring.application.name}
创建主启动类,创建controller,运行查看:
完成注册。