spring cloud eureka
来源:互联网 发布:爱站seo查询 编辑:程序博客网 时间:2024/06/05 07:19
官方原文地址:
https://spring.io/guides/gs/service-registration-and-discovery/
eureka-service/pom.xml:
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.example</groupId><artifactId>eureka-service</artifactId><version>0.0.1-SNAPSHOT</version><packaging>jar</packaging><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>1.5.2.RELEASE</version><relativePath/> <!-- lookup parent from repository --></parent><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><java.version>1.8</java.version></properties><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-eureka-server</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency></dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>Camden.SR5</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>
服务中心启动类:@EnableEurekaServer@SpringBootApplicationpublic class EurekaServiceApplication { public static void main(String[] args) { SpringApplication.run(EurekaServiceApplication.class, args); }}
服务中心配置: applications.propertiesserver.port=8761eureka.instance.hostname=localhost#默认为true,作为服务中心,需要把以下俩值设置为falseeureka.client.register-with-eureka=falseeureka.client.fetch-registry=falseeureka.client.service-url.DEFAULT_ZONE =http://${eureka.instance.hostname}:${server.port}/eureka/eureka.server.wait-time-in-ms-when-sync-empty=0
eureka-client/pom.xml:
eureka-client:启动类<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.example</groupId><artifactId>eureka-client</artifactId><version>0.0.1-SNAPSHOT</version><packaging>jar</packaging><parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>1.5.2.RELEASE</version><relativePath/> <!-- lookup parent from repository --></parent><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><java.version>1.8</java.version></properties><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-eureka</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-eureka-server</artifactId><scope>test</scope></dependency></dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>Camden.SR5</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build></project>
eureka-client:配置@EnableDiscoveryClient@SpringBootApplicationpublic class EurekaClientApplication { public static void main(String[] args) { SpringApplication.run(EurekaClientApplication.class, args); }}
spring.application.name=MVeureka.client.service-url.defaultZone=http://localhost:8761/eureka/
阅读全文
0 0
- spring cloud-eureka
- Spring-cloud Eureka 集群
- spring cloud eureka
- Spring Cloud Eureka
- Spring Cloud Netflix Eureka
- Spring Cloud Eureka详解
- Spring Cloud Eureka
- Spring Cloud Eureka
- spring cloud eureka
- spring cloud教程---Eureka
- Spring Cloud Eureka
- spring cloud之eureka
- 关于Spring Cloud Eureka
- spring-cloud【eureka】
- spring-cloud系列-Eureka
- Spring Cloud Eureka 初探
- Spring Cloud Eureka
- spring cloud eureka
- 将数据转成JSON
- oracle常用命令--更新/修改表数据之alter命令
- u-boot分析之Makefile
- PAT_1063. Set Similarity(1个case超时)
- validateform在提交form表单时,手动触发validateform校验
- spring cloud eureka
- STL algorithm -2
- 美国地质调查局DEM,需账户密码
- 简单的hash
- 学习的本质
- Ubuntu14 安装mysqlclient (MySQLdb)python3
- js中事件对象event的兼容性问题
- 遗传算法详解
- Markdown常识