File tree 13 files changed +212
-1
lines changed
lab-35-admin-01-demo-application/src/main/java/cn/iocoder/springboot/lab35/demo
lab-35-admin-02-adminserver
java/cn/iocoder/springboot/lab35/adminserver
lab-35-admin-02-demo-application
java/cn/iocoder/springboot/lab35/demo
lab-35-admin-02-eurekaserver
java/cn/iocoder/springboot/lab35/eurekaserver
13 files changed +212
-1
lines changed Original file line number Diff line number Diff line change 1
- package cn .iocoder .springboot .lab34 . actuatordemo ;
1
+ package cn .iocoder .springboot .lab35 . demo ;
2
2
3
3
import org .springframework .boot .SpringApplication ;
4
4
import org .springframework .boot .autoconfigure .SpringBootApplication ;
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5
+ <parent >
6
+ <groupId >org.springframework.boot</groupId >
7
+ <artifactId >spring-boot-starter-parent</artifactId >
8
+ <version >2.2.2.RELEASE</version >
9
+ <relativePath /> <!-- lookup parent from repository -->
10
+ </parent >
11
+ <modelVersion >4.0.0</modelVersion >
12
+
13
+ <artifactId >lab-35-admin-02-adminserver</artifactId >
14
+
15
+ <dependencies >
16
+ <!-- 实现对 Spring Boot Admin Server 的自动化配置 -->
17
+ <!--
18
+ 包含 1. spring-boot-admin-server :Server 端
19
+ 2. spring-boot-admin-server-ui :UI 界面
20
+ 3. spring-boot-admin-server-cloud :对 Spring Cloud 的接入
21
+ -->
22
+ <dependency >
23
+ <groupId >de.codecentric</groupId >
24
+ <artifactId >spring-boot-admin-starter-server</artifactId >
25
+ <version >2.2.0</version >
26
+ </dependency >
27
+
28
+ <!-- 实现对 Eureka Client 的自动化配置 -->
29
+ <dependency >
30
+ <groupId >org.springframework.cloud</groupId >
31
+ <artifactId >spring-cloud-starter-netflix-eureka-client</artifactId >
32
+ <version >2.2.1.RELEASE</version >
33
+ </dependency >
34
+ </dependencies >
35
+
36
+ </project >
Original file line number Diff line number Diff line change
1
+ package cn .iocoder .springboot .lab35 .adminserver ;
2
+
3
+ import de .codecentric .boot .admin .server .config .EnableAdminServer ;
4
+ import org .springframework .boot .SpringApplication ;
5
+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
6
+ import org .springframework .cloud .client .discovery .EnableDiscoveryClient ;
7
+
8
+ @ SpringBootApplication
9
+ @ EnableAdminServer
10
+ @ EnableDiscoveryClient
11
+ public class AdminServerApplication {
12
+
13
+ public static void main (String [] args ) {
14
+ SpringApplication .run (AdminServerApplication .class , args );
15
+ }
16
+
17
+ }
Original file line number Diff line number Diff line change
1
+ eureka :
2
+ client :
3
+ service-url :
4
+ defaultZone : http://127.0.0.1:8761/eureka
5
+ register-with-eureka : false
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5
+ <parent >
6
+ <groupId >org.springframework.boot</groupId >
7
+ <artifactId >spring-boot-starter-parent</artifactId >
8
+ <version >2.2.2.RELEASE</version >
9
+ <relativePath /> <!-- lookup parent from repository -->
10
+ </parent >
11
+ <modelVersion >4.0.0</modelVersion >
12
+
13
+ <artifactId >lab-35-admin-02-demo-application</artifactId >
14
+
15
+ <dependencies >
16
+ <!-- 实现对 Spring MVC 的自动化配置 -->
17
+ <dependency >
18
+ <groupId >org.springframework.boot</groupId >
19
+ <artifactId >spring-boot-starter-web</artifactId >
20
+ </dependency >
21
+
22
+ <!-- 实现对 Actuator 的自动化配置 -->
23
+ <dependency >
24
+ <groupId >org.springframework.boot</groupId >
25
+ <artifactId >spring-boot-starter-actuator</artifactId >
26
+ </dependency >
27
+
28
+ <!-- 实现对 Eureka Client 的自动化配置 -->
29
+ <dependency >
30
+ <groupId >org.springframework.cloud</groupId >
31
+ <artifactId >spring-cloud-starter-netflix-eureka-client</artifactId >
32
+ <version >2.2.1.RELEASE</version >
33
+ </dependency >
34
+ </dependencies >
35
+
36
+ </project >
Original file line number Diff line number Diff line change
1
+ package cn .iocoder .springboot .lab35 .demo ;
2
+
3
+ import org .springframework .boot .SpringApplication ;
4
+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
5
+ import org .springframework .cloud .client .discovery .EnableDiscoveryClient ;
6
+
7
+ @ SpringBootApplication
8
+ @ EnableDiscoveryClient
9
+ public class Demo01Application {
10
+
11
+ public static void main (String [] args ) {
12
+ System .setProperty ("server.port" , "18081" );
13
+ SpringApplication .run (Demo01Application .class , args );
14
+ }
15
+
16
+ }
Original file line number Diff line number Diff line change
1
+ package cn .iocoder .springboot .lab35 .demo ;
2
+
3
+ import org .springframework .boot .SpringApplication ;
4
+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
5
+ import org .springframework .cloud .client .discovery .EnableDiscoveryClient ;
6
+
7
+ @ SpringBootApplication
8
+ @ EnableDiscoveryClient
9
+ public class Demo02Application {
10
+
11
+ public static void main (String [] args ) {
12
+ System .setProperty ("server.port" , "18082" );
13
+ SpringApplication .run (Demo02Application .class , args );
14
+ }
15
+
16
+ }
Original file line number Diff line number Diff line change
1
+ management :
2
+ endpoints :
3
+ # Actuator HTTP 配置项,对应 WebEndpointProperties 配置类
4
+ web :
5
+ exposure :
6
+ include : ' *' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
7
+
8
+ spring :
9
+ application :
10
+ name : demo-application # 应用名
11
+
12
+ eureka :
13
+ client :
14
+ service-url :
15
+ defaultZone : http://127.0.0.1:8761/eureka
Original file line number Diff line number Diff line change
1
+ management :
2
+ endpoints :
3
+ # Actuator HTTP 配置项,对应 WebEndpointProperties 配置类
4
+ web :
5
+ exposure :
6
+ include : ' *' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。
7
+
8
+ spring :
9
+ application :
10
+ name : demo-application # 应用名
11
+
12
+ eureka :
13
+ client :
14
+ service-url :
15
+ defaultZone : http://127.0.0.1:8761/eureka
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
3
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
4
+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5
+ <parent >
6
+ <groupId >org.springframework.boot</groupId >
7
+ <artifactId >spring-boot-starter-parent</artifactId >
8
+ <version >2.2.2.RELEASE</version >
9
+ <relativePath /> <!-- lookup parent from repository -->
10
+ </parent >
11
+ <modelVersion >4.0.0</modelVersion >
12
+
13
+ <artifactId >lab-35-admin-02-eurekaserver</artifactId >
14
+
15
+ <dependencies >
16
+ <dependency >
17
+ <groupId >org.springframework.cloud</groupId >
18
+ <artifactId >spring-cloud-starter-netflix-eureka-server</artifactId >
19
+ <version >2.2.1.RELEASE</version >
20
+ </dependency >
21
+ </dependencies >
22
+
23
+ </project >
Original file line number Diff line number Diff line change
1
+ package cn .iocoder .springboot .lab35 .eurekaserver ;
2
+
3
+ import org .springframework .boot .SpringApplication ;
4
+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
5
+ import org .springframework .cloud .netflix .eureka .server .EnableEurekaServer ;
6
+
7
+ @ SpringBootApplication
8
+ @ EnableEurekaServer
9
+ public class EurekaServerApplication {
10
+
11
+ public static void main (String [] args ) {
12
+ SpringApplication .run (EurekaServerApplication .class , args );
13
+ }
14
+
15
+ }
Original file line number Diff line number Diff line change
1
+ spring :
2
+ application :
3
+ name : eureka-server
4
+
5
+ server :
6
+ port : 8761
7
+
8
+ eureka :
9
+ client :
10
+ # service-url:
11
+ # defaultZone: http://127.0.0.1:8761/eureka/
12
+ register-with-eureka : false
13
+ fetch-registry : false
Original file line number Diff line number Diff line change 14
14
<modules >
15
15
<module >lab-35-admin-01-adminserver</module >
16
16
<module >lab-35-admin-01-demo-application</module >
17
+
18
+ <module >lab-35-admin-02-adminserver</module >
19
+ <module >lab-35-admin-02-demo-application</module >
20
+ <module >lab-35-admin-02-eurekaserver</module >
17
21
</modules >
18
22
19
23
You can’t perform that action at this time.
0 commit comments