博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
php开发微服务注册到eureka中(使用sidecar)
阅读量:4072 次
发布时间:2019-05-25

本文共 2256 字,大约阅读时间需要 7 分钟。

使用php开发微服务,注册到eureka中的解决方案:sidecar。

sidecar 介绍请见:

 

 

  POM文件

  

com.ylm
side_car_test
0.0.1-SNAPSHOT
jar
side_car_test
org.springframework.boot
spring-boot-starter-parent
2.0.4.RELEASE
UTF-8
UTF-8
1.8
aliRepository
aliRepository
http://maven.aliyun.com/nexus/content/groups/public/
false
org.springframework.cloud
spring-cloud-dependencies
Finchley.RELEASE
pom
import
org.springframework.boot
spring-boot-starter
org.springframework.boot
spring-boot-starter-test
test
org.springframework.cloud
spring-cloud-netflix-sidecar
org.springframework.cloud
spring-cloud-starter-netflix-eureka-client
org.springframework.boot
spring-boot-maven-plugin

  启动类 

@SpringBootApplication@EnableSidecarpublic class SideCarServerApplication {	public static void main(String[] args) {		SpringApplication.run(SideCarServerApplication.class, args);	}}

  YLM

eureka:  instance:    hostname: localhost  client:    register-with-eureka: true    fetch-registry: true    serviceUrl:      defaultZone: http://eureka.tz.ylmo2o.com:20881/eureka/sidecar:  port: 80  instance:    hostname: localhost  health-uri: http://${sidecar.instance.hostname}:${sidecar.port}/health.php

反馈php服务是否健康的代码

   php rest接口

  

'啊啊');echo json_encode($arr,JSON_UNESCAPED_UNICODE);

     java 服务消费者 接口

@FeignClient(value = "testPhp", configuration=FeignConfiguration.class)public interface SideCarApiService {    @RequestLine("POST /hello.php")    HashMap
sayHello();}

    重头戏 PHP 调用注册中心的其他服务的接口

   

 

转载地址:http://xgwni.baihongyu.com/

你可能感兴趣的文章
支付宝生活号服务号 用户信息获取 oauth2 登录对接 springboot java
查看>>
CodeForces #196(Div. 2) 337D Book of Evil (树形dp)
查看>>
uva 12260 - Free Goodies (dp,贪心 | 好题)
查看>>
uva-1427 Parade (单调队列优化dp)
查看>>
【设计模式】学习笔记14:状态模式(State)
查看>>
poj 1976 A Mini Locomotive (dp 二维01背包)
查看>>
斯坦福大学机器学习——因子分析(Factor analysis)
查看>>
项目导入时报错:The import javax.servlet.http.HttpServletRequest cannot be resolved
查看>>
linux对于没有写权限的文件如何保存退出vim
查看>>
Windows下安装ElasticSearch6.3.1以及ElasticSearch6.3.1的Head插件
查看>>
IntelliJ IDEA 下的svn配置及使用的非常详细的图文总结
查看>>
【IntelliJ IDEA】idea导入项目只显示项目中的文件,不显示项目结构
查看>>
ssh 如何方便的切换到其他节点??
查看>>
JSP中文乱码总结
查看>>
Java-IO-File类
查看>>
Java-IO-java的IO流
查看>>
Java-IO-输入/输出流体系
查看>>
Java实现DES加密解密
查看>>
HTML基础
查看>>
Java IO
查看>>