启动类中添加@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
文章为作者独立观点,不代表观点