今天在学习springcloud时,学习到eruka的时候加入了依赖和配置之后启动报错:Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://127.0.0.1:10086/eureka/}, exception=java.net.ConnectException: Connection refused: no further information stacktrace=com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: no further information at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle
这是因为配置文件中少加了一些东西。
我们只需要在service和client的application.yaml文件加入如下配置即可:
register-with-eureka: false #是否将自己注册到Eureka Server上,默认为true
fetch-registry: false #是否从Eureka Server上获取注册信息,默认为true
加上之后再次启动就不报错了。