From 47f7d3a5d47e700e64547380e1d5ed22207031c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?LI-CCONG=5C=E6=9D=8E=E8=81=AA=E8=81=AA?= <1441652193@qq.com>
Date: Thu, 21 Mar 2024 17:01:59 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=9B=91=E6=8E=A7=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E6=95=B4=E5=90=88v2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
nxhs-monitor/pom.xml | 46 +++++++++++++++++++
.../java/cc/yunxi/MonitorApplication.java | 21 +++++++++
.../src/main/resources/application.yml | 10 ++++
nxhs-service/pom.xml | 4 +-
.../src/main/resources/application.yml | 33 +++++++++++++
5 files changed, 112 insertions(+), 2 deletions(-)
create mode 100644 nxhs-monitor/pom.xml
create mode 100644 nxhs-monitor/src/main/java/cc/yunxi/MonitorApplication.java
create mode 100644 nxhs-monitor/src/main/resources/application.yml
diff --git a/nxhs-monitor/pom.xml b/nxhs-monitor/pom.xml
new file mode 100644
index 0000000..1dd56c1
--- /dev/null
+++ b/nxhs-monitor/pom.xml
@@ -0,0 +1,46 @@
+
+
+ 4.0.0
+
+ cc.yunxi
+ nxhs-monitor
+ 1.0-SNAPSHOT
+ 宁夏回收应用监控平台
+
+
+ 8
+ 8
+ UTF-8
+ 2.7.6
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring-boot.version}
+ pom
+ import
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ de.codecentric
+ spring-boot-admin-starter-server
+ ${spring-boot.version}
+
+
+
+
+
\ No newline at end of file
diff --git a/nxhs-monitor/src/main/java/cc/yunxi/MonitorApplication.java b/nxhs-monitor/src/main/java/cc/yunxi/MonitorApplication.java
new file mode 100644
index 0000000..925f2fb
--- /dev/null
+++ b/nxhs-monitor/src/main/java/cc/yunxi/MonitorApplication.java
@@ -0,0 +1,21 @@
+package cc.yunxi;
+
+import de.codecentric.boot.admin.server.config.EnableAdminServer;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+import javax.annotation.PreDestroy;
+
+@SpringBootApplication
+@EnableAdminServer
+public class MonitorApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(MonitorApplication.class, args);
+ }
+
+
+ @PreDestroy
+ public void PreDestroy(){
+ System.out.println("MonitorApplication Shutdown...");
+ }
+}
diff --git a/nxhs-monitor/src/main/resources/application.yml b/nxhs-monitor/src/main/resources/application.yml
new file mode 100644
index 0000000..6b6f341
--- /dev/null
+++ b/nxhs-monitor/src/main/resources/application.yml
@@ -0,0 +1,10 @@
+server:
+ port: 9100
+
+info:
+ name: 宁夏回收应用服务监控
+
+spring:
+ application:
+ # 应用名称
+ name: nxhs-monitor
diff --git a/nxhs-service/pom.xml b/nxhs-service/pom.xml
index fe97c61..4de1c4f 100644
--- a/nxhs-service/pom.xml
+++ b/nxhs-service/pom.xml
@@ -45,8 +45,8 @@
- org.springframework.boot
- spring-boot-starter-actuator
+ de.codecentric
+ spring-boot-admin-starter-client
diff --git a/nxhs-service/src/main/resources/application.yml b/nxhs-service/src/main/resources/application.yml
index 35b897a..e5f8874 100644
--- a/nxhs-service/src/main/resources/application.yml
+++ b/nxhs-service/src/main/resources/application.yml
@@ -1,6 +1,29 @@
server:
port: 8080
+management:
+ endpoints:
+ web:
+ base-path: /monitor
+ exposure:
+ include: '*'
+ endpoint:
+ health:
+ show-details: always # 开启健康检查的完整信息
+ shutdown:
+ enabled: true
+ info:
+ enabled: true
+ info: #配置info信息
+ env:
+ enabled: true
+
+info:
+ name: 宁夏回收应用服务
+ domain: 'https://nxhs.cjyx.cc'
+ version: 0.0.1
+ describe: '推动家电以旧换新活动和绿色智能家电下乡、支持废旧家电回收……'
+
spring:
application:
name: nxhs-service
@@ -11,6 +34,15 @@ spring:
enabled: true #是否启用分段上传支持
profiles:
active: dev
+ boot:
+ admin:
+ client:
+ url: http://localhost:9100
+ instance:
+ name: ${spring.application.name}
+ service-url: http://localhost:${server.port}
+# username: admin
+# password: admin123
datasource:
url: jdbc:mysql://127.0.0.1:3306/nxhs?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai
driver-class-name: com.mysql.cj.jdbc.Driver
@@ -46,6 +78,7 @@ logging:
dateformat: yyyy-MM-dd HH:mm:ss:SSS
file:
path: "${user.dir}/logs/${spring.application.name}"
+ name: "${logging.file.path}/log_debug.log"
knife4j:
enable: true