Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8df01a4

Browse files
committed
update
1 parent6b0bdff commit8df01a4

File tree

2 files changed

+56
-56
lines changed

2 files changed

+56
-56
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
11
#实现服务的注册与发现
22

3+
4+
本章节,我们将创建一个`micro-weather-eureka-client` 作为客户端,并演示如何让将自身向注册服务器进行注册,让其可以其他服务都调用。
5+
6+
##开发环境
7+
8+
* Gradle 4.0
9+
* Spring Boot 2.0.0.M3
10+
* Spring Cloud Netflix Eureka Client Finchley.M2
11+
12+
13+
##更改配置
14+
15+
增加如下配置:
16+
17+
```groovy
18+
dependencies {
19+
//...
20+
21+
compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-client')
22+
23+
//...
24+
}
25+
```
26+
27+
##一个最简单的 Eureka Client
28+
29+
```java
30+
@SpringBootApplication
31+
@EnableDiscoveryClient
32+
@RestController
33+
publicclassApplication {
34+
35+
@RequestMapping("/")
36+
publicStringhome() {
37+
return"Hello world";
38+
}
39+
40+
publicstaticvoidmain(String[]args) {
41+
SpringApplication.run(Application.class, args);
42+
}
43+
}
44+
```
45+
46+
项目配置:
47+
48+
```
49+
spring.application.name: micro-weather-eureka-client
50+
51+
eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/
52+
```
53+
54+
##运行
55+
56+
分别在 8081 和 8082 上启动了客户端示例。可以在 Eureka Server 上看到这两个实体的信息。
57+
58+
![eurake-client](../../images/register-discover/eurake-client.jpg)
Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1 @@
11
#微服务的注册与发现
2-
3-
本章节,我们将创建一个`micro-weather-eureka-client` 作为客户端,并演示如何让将自身向注册服务器进行注册,让其可以其他服务都调用。
4-
5-
##开发环境
6-
7-
* Gradle 4.0
8-
* Spring Boot 2.0.0.M3
9-
* Spring Cloud Netflix Eureka Client Finchley.M2
10-
11-
12-
##更改配置
13-
14-
增加如下配置:
15-
16-
```groovy
17-
dependencies {
18-
//...
19-
20-
compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-client')
21-
22-
//...
23-
}
24-
```
25-
26-
##一个最简单的 Eureka Client
27-
28-
```java
29-
@SpringBootApplication
30-
@EnableDiscoveryClient
31-
@RestController
32-
publicclassApplication {
33-
34-
@RequestMapping("/")
35-
publicStringhome() {
36-
return"Hello world";
37-
}
38-
39-
publicstaticvoidmain(String[]args) {
40-
SpringApplication.run(Application.class, args);
41-
}
42-
}
43-
```
44-
45-
项目配置:
46-
47-
```
48-
spring.application.name: micro-weather-eureka-client
49-
50-
eureka.client.serviceUrl.defaultZone: http://localhost:8761/eureka/
51-
```
52-
53-
##运行
54-
55-
分别在 8081 和 8082 上启动了客户端示例。可以在 Eureka Server 上看到这两个实体的信息。
56-
57-
![eurake-client](../../images/register-discover/eurake-client.jpg)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp