From ec0b75ade202d84a5514932f63e575058e64a7ad Mon Sep 17 00:00:00 2001 From: blinkfox Date: Sat, 2 Jan 2021 23:03:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E5=9C=A8=E6=96=B0?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E4=B8=AD=20debug=20=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE=E9=A1=B9=E5=92=8C=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/blinkfox/fenix/starter/FenixAutoConfiguration.java | 2 ++ .../java/com/blinkfox/fenix/starter/FenixProperties.java | 7 +++++++ .../fenix/starter/FenixStarterApplicationTest.java | 1 + 3 files changed, 10 insertions(+) diff --git a/src/main/java/com/blinkfox/fenix/starter/FenixAutoConfiguration.java b/src/main/java/com/blinkfox/fenix/starter/FenixAutoConfiguration.java index 722e181..34cc15d 100755 --- a/src/main/java/com/blinkfox/fenix/starter/FenixAutoConfiguration.java +++ b/src/main/java/com/blinkfox/fenix/starter/FenixAutoConfiguration.java @@ -44,6 +44,7 @@ public FenixAutoConfiguration(FenixProperties properties) { */ private void doConfig() { // 获取配置值. + Boolean debug = this.properties.getDebug(); Boolean printBanner = this.properties.getPrintBanner(); Boolean printSql = this.properties.getPrintSql(); Boolean showJpaSql = this.properties.getShowJpaSql(); @@ -53,6 +54,7 @@ private void doConfig() { // 配置常规信息、 xml 和 handler 的扫描路径. // 如果未配置 printSql,则使用 jpa 中 show-sql 的配置值,否则使用 printSql 的值. FenixConfigManager.getInstance().initLoad(new FenixConfig() + .setDebug(Boolean.TRUE.equals(debug)) .setPrintBanner(printBanner == null || Boolean.TRUE.equals(printBanner)) .setPrintSqlInfo(printSql == null ? Boolean.TRUE.equals(showJpaSql) : Boolean.TRUE.equals(printSql)) .setXmlLocations(CollectionUtils.isEmpty(xmlLocations) ? null : String.join(Const.COMMA, xmlLocations)) diff --git a/src/main/java/com/blinkfox/fenix/starter/FenixProperties.java b/src/main/java/com/blinkfox/fenix/starter/FenixProperties.java index 0423230..6550d0e 100755 --- a/src/main/java/com/blinkfox/fenix/starter/FenixProperties.java +++ b/src/main/java/com/blinkfox/fenix/starter/FenixProperties.java @@ -16,6 +16,13 @@ @ConfigurationProperties("fenix") class FenixProperties { + /** + * 是否开启 debug 模式. + * + * @since v2.4.1 + */ + private Boolean debug = false; + /** * 是否打印 Fenix 加载完配置信息后的启动 banner,默认为 true. */ diff --git a/src/test/java/com/blinkfox/fenix/starter/FenixStarterApplicationTest.java b/src/test/java/com/blinkfox/fenix/starter/FenixStarterApplicationTest.java index 4ccec51..6528fed 100644 --- a/src/test/java/com/blinkfox/fenix/starter/FenixStarterApplicationTest.java +++ b/src/test/java/com/blinkfox/fenix/starter/FenixStarterApplicationTest.java @@ -22,6 +22,7 @@ class FenixStarterApplicationTest { void testFenixConfig() { // 测试常规配置. FenixConfig fenixConfig = FenixConfigManager.getInstance().getFenixConfig(); + Assertions.assertFalse(fenixConfig.isDebug()); Assertions.assertTrue(fenixConfig.isPrintBanner()); Assertions.assertFalse(fenixConfig.isPrintSqlInfo());