From a13e476f727e4152e2bd18c770920847d6658f14 Mon Sep 17 00:00:00 2001 From: Wendal Chen Date: Thu, 12 Mar 2020 16:53:58 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B9,=E5=8F=AF=E4=BB=A5=E5=AE=8C?= =?UTF-8?q?=E5=85=A8=E5=85=B3=E9=97=ADdruid=E7=9A=84monitor=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nutz/boot/starter/jdbc/DruidWebStatServletStarter.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nutzboot-starter/nutzboot-starter-jdbc/src/main/java/org/nutz/boot/starter/jdbc/DruidWebStatServletStarter.java b/nutzboot-starter/nutzboot-starter-jdbc/src/main/java/org/nutz/boot/starter/jdbc/DruidWebStatServletStarter.java index 61b6ba6d..46779964 100644 --- a/nutzboot-starter/nutzboot-starter-jdbc/src/main/java/org/nutz/boot/starter/jdbc/DruidWebStatServletStarter.java +++ b/nutzboot-starter/nutzboot-starter-jdbc/src/main/java/org/nutz/boot/starter/jdbc/DruidWebStatServletStarter.java @@ -23,6 +23,9 @@ public class DruidWebStatServletStarter implements WebServletFace { protected static final String PRE = "druid.web.servlet."; + @PropDoc(group="druid", type="boolean", defaultValue="true", value="是否启动monitor页面") + public static final String PROP_ENABLE = PRE + "enable"; + @PropDoc(group="druid", type="boolean", defaultValue="true", value="是否允许重置统计结果") public static final String PROP_RESET_ENABLE = PRE + StatViewServlet.PARAM_NAME_RESET_ENABLE; @@ -80,6 +83,10 @@ public class DruidWebStatServletStarter implements WebServletFace { public Servlet getServlet() { if (!DataSourceStarter.isDruid(conf)) return null; + if (!conf.getBoolean(PROP_ENABLE, true)) { + log.debug("druid monitor enable=false, disable it"); + return null; + } return new StatViewServlet(); }