1. 服务器端例子
1.1. 使用maven构建SpringBoot的名叫sing-boot-admin-server项目
1.2. 配置pom.xml
4.0.0 com.bjbs sing-boot-admin-server0.0.1-SNAPSHOT org.springframework.boot spring-boot-starter-parent1.5.13.RELEASE 1.8 org.springframework.boot spring-boot-starter-webde.codecentric spring-boot-admin-starter-server1.5.7
1.3. 在src/main/resources下, 新建application.properties, 配置端口号
server.port=9090
1.4. 新建App.java
package com.bjbs;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import de.codecentric.boot.admin.config.EnableAdminServer;
@SpringBootApplication
@EnableAdminServer // 开启AdminServer
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
2. 客户端例子
2.1. 使用maven构建SpringBoot的名叫sing-boot-admin-server项目
2.2. 配置pom.xml
4.0.0 com.bjbs spring-boot-admin-client0.0.1-SNAPSHOT org.springframework.boot spring-boot-starter-parent1.5.13.RELEASE 1.8 org.springframework.boot spring-boot-starter-webde.codecentric spring-boot-admin-starter-client1.5.7 org.jolokia jolokia-corecom.googlecode.json-simple json-simple
2.3. 在src/main/resources下, 新建application.properties
#关闭安全限制, 它的默认值是true management.security.enabled=false #Spring Boot Admin服务端的IP地 址以及端口号 spring.boot.admin.url: http://localhost:9090
2.4. 新建App.java
package com.bjbs;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
3. 运行项目
3.1. 运行服务端
3.2. 运行客户端
3.3. 浏览器访问服务器端
3.4. 查看详情



