From aa2103bd41614ad28f11bf562d2146cc2040ef7b Mon Sep 17 00:00:00 2001 From: Wendal Chen Date: Tue, 26 Dec 2017 21:54:32 +0800 Subject: [PATCH] =?UTF-8?q?change:=20ureport=E9=BB=98=E8=AE=A4=E4=B8=8D?= =?UTF-8?q?=E5=85=B3=E8=81=94=E6=95=B0=E6=8D=AE=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.properties | 3 ++- .../nutz/boot/starter/nutz/mvc/NutFilterStarter.java | 2 +- .../boot/starter/ureport/UreportSpringEnvStarter.java | 10 ++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/nutzboot-demo/nutzboot-demo-simple/nutzboot-demo-simple-ureport/src/main/resources/application.properties b/nutzboot-demo/nutzboot-demo-simple/nutzboot-demo-simple-ureport/src/main/resources/application.properties index 87efe15a..78ef2e77 100644 --- a/nutzboot-demo/nutzboot-demo-simple/nutzboot-demo-simple-ureport/src/main/resources/application.properties +++ b/nutzboot-demo/nutzboot-demo-simple/nutzboot-demo-simple-ureport/src/main/resources/application.properties @@ -3,4 +3,5 @@ jetty.host=127.0.0.1 jdbc.url=jdbc:h2:mem:~ -ureport.repository.dir=./ureport.repo \ No newline at end of file +ureport.repository.dir=./ureport.repo +ureport.nutzboot.dsName=nutzboot diff --git a/nutzboot-starter-nutz-mvc/src/main/java/org/nutz/boot/starter/nutz/mvc/NutFilterStarter.java b/nutzboot-starter-nutz-mvc/src/main/java/org/nutz/boot/starter/nutz/mvc/NutFilterStarter.java index 61c26549..02e8d55f 100644 --- a/nutzboot-starter-nutz-mvc/src/main/java/org/nutz/boot/starter/nutz/mvc/NutFilterStarter.java +++ b/nutzboot-starter-nutz-mvc/src/main/java/org/nutz/boot/starter/nutz/mvc/NutFilterStarter.java @@ -51,7 +51,7 @@ public class NutFilterStarter implements WebFilterFace { if (conf.has("nutz.mvc.ignore")) { params.put("ignore", conf.get("nutz.mvc.ignore")); } - params.put("exclusions", conf.get("nutz.mvc.exclusions", "/druid/*,/uflo/*,/webservice/*,/swagger/*")); + params.put("exclusions", conf.get("nutz.mvc.exclusions", "/druid/*,/uflo/*,/ureport/*,/urule/*,/webservice/*,/swagger/*")); return params; } diff --git a/nutzboot-starter-ureport/src/main/java/org/nutz/boot/starter/ureport/UreportSpringEnvStarter.java b/nutzboot-starter-ureport/src/main/java/org/nutz/boot/starter/ureport/UreportSpringEnvStarter.java index 218fa6cd..0cf91764 100644 --- a/nutzboot-starter-ureport/src/main/java/org/nutz/boot/starter/ureport/UreportSpringEnvStarter.java +++ b/nutzboot-starter-ureport/src/main/java/org/nutz/boot/starter/ureport/UreportSpringEnvStarter.java @@ -8,8 +8,11 @@ import javax.servlet.ServletContextEvent; import javax.sql.DataSource; import org.nutz.boot.tools.SpringWebContextProxy; +import org.nutz.ioc.impl.PropertiesProxy; +import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.lang.Mirror; +import org.nutz.lang.Strings; import com.bstek.ureport.Utils; import com.bstek.ureport.definition.datasource.BuildinDatasource; @@ -18,6 +21,9 @@ import com.bstek.ureport.provider.image.ImageProvider; @IocBean public class UreportSpringEnvStarter extends SpringWebContextProxy { + @Inject + protected PropertiesProxy conf; + public UreportSpringEnvStarter() { configLocation = "classpath:ureport-spring-context.xml"; selfName = "ureport"; @@ -35,12 +41,12 @@ public class UreportSpringEnvStarter extends SpringWebContextProxy { super.contextInitialized(sce); // 把BuildinDatasource统统注册一下 List buildinDatasources = appContext.getBeans(BuildinDatasource.class); - if (appContext.getIoc().has("dataSource")) { + if (!Strings.isBlank(conf.get("ureport.nutzboot.dsName"))) { // 添加一个内置的BuildinDatasource DataSource ds = appContext.getIoc().get(DataSource.class); buildinDatasources.add(new BuildinDatasource() { public String name() { - return "nutzboot.buildin"; + return conf.get("ureport.nutzboot.dsName"); } public Connection getConnection() {