博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Springboot 2.1.1版本搭建监控服务
阅读量:3764 次
发布时间:2019-05-22

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

一、搭建服务端

1.首先搭建springboot_adminserver项目、添加pom.xml的依赖。

4.0.0
org.springframework.boot
spring-boot-starter-parent
2.1.1.RELEASE
com.citydo
springboot_adminserver
0.0.1-SNAPSHOT
jar
springboot_adminserver
Demo project for Spring Boot
1.8
2.1.1
de.codecentric
spring-boot-admin-starter-server
de.codecentric
spring-boot-admin-server-ui
${spring-boot-admin.version}
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-starter-web
de.codecentric
spring-boot-admin-dependencies
${spring-boot-admin.version}
pom
import
org.springframework.boot
spring-boot-maven-plugin

2.配置端口server.port=8080、也可以用默认端口。

3.在启动类添加注解。

package com.citydo.springboot_adminserver;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import de.codecentric.boot.admin.server.config.EnableAdminServer;@SpringBootApplication@EnableAdminServerpublic class SpringbootAdminserverApplication {    public static void main(String[] args) {        SpringApplication.run(SpringbootAdminserverApplication.class, args);    }}

一、搭建客户端

4.首先搭建springboot_adminclient项目、添加pom.xml的依赖。

4.0.0
org.springframework.boot
spring-boot-starter-parent
2.1.1.RELEASE
com.citydo
springboot_adminclient
0.0.1-SNAPSHOT
jar
springboot_adminclient
Demo project for Spring Boot
1.8
2.1.1
de.codecentric
spring-boot-admin-starter-client
org.springframework.boot
spring-boot-starter-actuator
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-test
test
de.codecentric
spring-boot-admin-dependencies
${spring-boot-admin.version}
pom
import
org.springframework.boot
spring-boot-maven-plugin

5、在客户端服务中添加application.properties

server.port=8081spring.application.name=Spring Boot Clientspring.boot.admin.client.url=http://localhost:8080management.endpoints.web.exposure.include=*

6.客户端启动类。

package com.citydo.springboot_adminclient;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplicationpublic class SpringbootAdminclientApplication {    public static void main(String[] args) {        SpringApplication.run(SpringbootAdminclientApplication.class, args);    }}

7.访问http://127.0.0.1:8080路径。

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

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

你可能感兴趣的文章
JDBC工具类 使用Durid连接池链接MySQL数据库
查看>>
ANSYS——模态提取方法简介
查看>>
ANSYS——初学路径之路径的定义、作用以及ansys路径模块GUI的操作解释
查看>>
ANSYS——网格划分的不同方法以及GUI模块的操作(自由网格、映射网格、扫掠、拖拉)
查看>>
ANSYS——命令流学习(材料属性设置、建模的命令流)
查看>>
ANSYS——杆单元简介与示例(含新版本2019版本杆实常数设置、ANSYS help的使用、单元列表使用的举例)
查看>>
ANSYS——后处理中单元表(ELEMENT table)的作用、创建、使用
查看>>
在VScode上配置golang的开发环境
查看>>
leetcode每日一题---680. 验证回文字符串 Ⅱ
查看>>
leetcode每日一题---15. 三数之和
查看>>
leetcode每日一题---面试题 16.18. 模式匹配
查看>>
地主的钱袋
查看>>
招新成绩统计
查看>>
webpack
查看>>
go部署
查看>>
配置swagger--go语言
查看>>
打印杨辉三角
查看>>
java中String类中常用方法
查看>>
flutter学习笔记:第一个APP应用
查看>>
哲学家进餐问题
查看>>