diff --git a/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/web/handler/GlobalResponseBodyHandler.java b/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/web/handler/GlobalResponseBodyHandler.java index 8c5fd14c4..c10b72ca7 100644 --- a/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/web/handler/GlobalResponseBodyHandler.java +++ b/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/web/handler/GlobalResponseBodyHandler.java @@ -18,7 +18,7 @@ public class GlobalResponseBodyHandler implements ResponseBodyAdvice { if (returnType.getMethod() == null) { return false; } - return returnType.getMethod().getReturnType().isAssignableFrom(CommonResult.class); + return returnType.getMethod().getReturnType() == CommonResult.class; } @Override diff --git a/pom.xml b/pom.xml index 45f2f5994..fe35bf9a6 100644 --- a/pom.xml +++ b/pom.xml @@ -58,6 +58,10 @@ 2.5 0.5.1 + + 0.6.0 + 1.1.4 + 1.8 @@ -233,12 +237,24 @@ spring-boot-admin-starter-client ${spring-boot-admin-starter-client.version} + + + io.micrometer + micrometer-registry-prometheus + ${micrometer.version} + + org.springframework.cloud spring-cloud-starter-alibaba-sentinel ${sentinel.version} + + io.prometheus + simpleclient_spring_boot + ${prometheus-spring-boot.version} + diff --git a/system/system-application/pom.xml b/system/system-application/pom.xml index 850280b11..bff5c20f7 100644 --- a/system/system-application/pom.xml +++ b/system/system-application/pom.xml @@ -65,6 +65,21 @@ spring-cloud-starter-alibaba-sentinel + + org.springframework.boot + spring-boot-starter-actuator + + + + io.micrometer + micrometer-registry-prometheus + + + + + + + org.springframework.boot diff --git a/system/system-application/src/main/java/cn/iocoder/mall/admin/application/config/MonitorConfiguration.java b/system/system-application/src/main/java/cn/iocoder/mall/admin/application/config/MonitorConfiguration.java new file mode 100644 index 000000000..d63e5d4fe --- /dev/null +++ b/system/system-application/src/main/java/cn/iocoder/mall/admin/application/config/MonitorConfiguration.java @@ -0,0 +1,9 @@ +package cn.iocoder.mall.admin.application.config; + +import org.springframework.context.annotation.Configuration; + +@Configuration +//@EnablePrometheusEndpoint +//@EnableSpringBootMetricsCollector +public class MonitorConfiguration { +} diff --git a/system/system-application/src/main/resources/application.yaml b/system/system-application/src/main/resources/application.yaml index a4420af3c..4e8c8a8b1 100644 --- a/system/system-application/src/main/resources/application.yaml +++ b/system/system-application/src/main/resources/application.yaml @@ -32,3 +32,11 @@ swagger: description: 管理员子系统 version: 1.0.0 base-package: cn.iocoder.mall.admin.application.controller + +management: + endpoints: + web: + exposure: + include: health,info,env,metrics,prometheus + metrics: + enabled: true