摘要:
服务之间是通过http协议调用,虽然效率较低但是具有良好的可扩展性和可维护性。可以通过httpclient,okhttp等调用但是有重复代码,较难维护,使用不便。现在流行的方式有RestTemplate和Feign两种方式。 RestTemplate是同步客户端执行HTTP请求,暴露出一个简单的、模 阅读全文
posted @ 2023-03-25 22:30
shigp1
阅读(246)
评论(0)
推荐(0)
摘要:
Eureka 健康检查 由于server和client通过心跳保持 服务状态,而只有状态为UP的服务才能被访问。看eureka界面中的status。 比如心跳一直正常,服务一直UP,但是此服务DB连不上了,无法正常提供服务。 此时,我们需要将微服务的健康状态也同步到server。只需要启动eurek 阅读全文
posted @ 2023-03-25 16:27
shigp1
阅读(682)
评论(0)
推荐(0)
摘要:
EurekaClient是Eureka提供的服务发现的接口。 在Consumer模块中,加入: @RequestMapping("/application") public Applications application() { Applications applications = eureka 阅读全文
posted @ 2023-03-25 14:06
shigp1
阅读(71)
评论(0)
推荐(0)
摘要:
springCloud提供的DiscoveryClient接口,抽象了服务发现的功能,只要实现了这个接口就能接入SpringCloud的体系中。 org.springframework.cloud.client.discovery.DiscoveryClient public interface D 阅读全文
posted @ 2023-03-25 13:25
shigp1
阅读(150)
评论(0)
推荐(0)
摘要:
新建名为Producer的Eureka client,添加spring-cloud-starter-netflix-eureka-client和spring-boot-starter-web依赖,并修改parent为SpringCloudDemo,并在SpringCloudDemo的pom.xml添 阅读全文
posted @ 2023-03-25 11:49
shigp1
阅读(28)
评论(0)
推荐(0)

浙公网安备 33010602011771号