change: ureport默认不关联数据源

This commit is contained in:
Wendal Chen 2017-12-26 21:54:32 +08:00
parent f4fd9376eb
commit aa2103bd41
3 changed files with 11 additions and 4 deletions

View File

@ -3,4 +3,5 @@ jetty.host=127.0.0.1
jdbc.url=jdbc:h2:mem:~ jdbc.url=jdbc:h2:mem:~
ureport.repository.dir=./ureport.repo ureport.repository.dir=./ureport.repo
ureport.nutzboot.dsName=nutzboot

View File

@ -51,7 +51,7 @@ public class NutFilterStarter implements WebFilterFace {
if (conf.has("nutz.mvc.ignore")) { if (conf.has("nutz.mvc.ignore")) {
params.put("ignore", conf.get("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; return params;
} }

View File

@ -8,8 +8,11 @@ import javax.servlet.ServletContextEvent;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.nutz.boot.tools.SpringWebContextProxy; 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.ioc.loader.annotation.IocBean;
import org.nutz.lang.Mirror; import org.nutz.lang.Mirror;
import org.nutz.lang.Strings;
import com.bstek.ureport.Utils; import com.bstek.ureport.Utils;
import com.bstek.ureport.definition.datasource.BuildinDatasource; import com.bstek.ureport.definition.datasource.BuildinDatasource;
@ -18,6 +21,9 @@ import com.bstek.ureport.provider.image.ImageProvider;
@IocBean @IocBean
public class UreportSpringEnvStarter extends SpringWebContextProxy { public class UreportSpringEnvStarter extends SpringWebContextProxy {
@Inject
protected PropertiesProxy conf;
public UreportSpringEnvStarter() { public UreportSpringEnvStarter() {
configLocation = "classpath:ureport-spring-context.xml"; configLocation = "classpath:ureport-spring-context.xml";
selfName = "ureport"; selfName = "ureport";
@ -35,12 +41,12 @@ public class UreportSpringEnvStarter extends SpringWebContextProxy {
super.contextInitialized(sce); super.contextInitialized(sce);
// 把BuildinDatasource统统注册一下 // 把BuildinDatasource统统注册一下
List<BuildinDatasource> buildinDatasources = appContext.getBeans(BuildinDatasource.class); List<BuildinDatasource> buildinDatasources = appContext.getBeans(BuildinDatasource.class);
if (appContext.getIoc().has("dataSource")) { if (!Strings.isBlank(conf.get("ureport.nutzboot.dsName"))) {
// 添加一个内置的BuildinDatasource // 添加一个内置的BuildinDatasource
DataSource ds = appContext.getIoc().get(DataSource.class); DataSource ds = appContext.getIoc().get(DataSource.class);
buildinDatasources.add(new BuildinDatasource() { buildinDatasources.add(new BuildinDatasource() {
public String name() { public String name() {
return "nutzboot.buildin"; return conf.get("ureport.nutzboot.dsName");
} }
public Connection getConnection() { public Connection getConnection() {