Spring Cloud 学习笔记(一)
一、启动Conful服务
- 现在conful
- cmd 执行consul agent -dev -ui -node=cy命令
- 访问地址:http://localhost:8500 /ui
二、创建项目进行注册
1.创建SSM项目
2.编写Controller
@RestController
@RequestMapping(value = “/user”)
public class TestController {
@GetMapping(value = “/hello”)
public String hello() {
return “My first Consul.”;
}
}
3.编写application.properties
server.port=8501
spring.application.name=springcloud1
spring.cloud.consul.host=localhost
spring.cloud.consul.port=8500
spring.cloud.consul.discovery.serviceName=data-service3
spring.cloud.consul.discov