添加maven依赖
org.springframework.cloud
spring-cloud-starter-netflix-大智慧股票交易数据接口,eureka-client
org.springframework.cloud
spring-cloud-starter-netflix-zuul
启动类中添加@EnableEurekaClient注解
@SpringBootApplication
@EnableEurekaClient
@RestController
@RequestMapping('api')
public class MyServiceApplication {
public static void main(String[] args) {
SpringApplication.run(MyServiceApplication.class, args);
}
@RequestMapping('sayHello')
public String sayHello(){
return 'hello world';
}
}
#在注册中心显示的名字
spring.application.name=zuul-server
server.port=8762
#注册中心的地址
大智慧股票交易数据接口,eureka.client.service-url.defaultZone=http://localhost:8761/大智慧股票交易数据接口,eureka
#启用熔断的开关
feign.hystrix.enabled=true
文章为作者独立观点,不代表观点