使用AutoTableBindPlugin后,启动非常慢

zmb做人厚道 发布于 2016/06/15 15:05
阅读 756
收藏 0

@绝望的八皮 你好,想跟你请教个问题:

@绝望的八皮 你好,想跟你请教个问题:

运行Server.java中的main函数,启动信息如下:

Starting JFinal 1.5
Starting scanner at interval of 5 seconds.
Starting web server on port: 80
..................
//运行到如下信息时卡住:
[INFO ] [13:49:20] com.alibaba.druid.pool.DruidDataSource - {dataSource-1} inited
//等待。。。。。。。
[INFO ] [14:08:24] org.quartz.impl.StdSchedulerFactory - Using default implementation for ThreadExecutor
[INFO ] [14:08:24] org.quartz.simpl.SimpleThreadPool - Job execution threads will use class loader of thread: main
[INFO ] [14:08:24] org.quartz.core.SchedulerSignalerImpl - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
[INFO ] [14:08:24] org.quartz.core.QuartzScheduler - Quartz Scheduler v.1.8.6 created.
[INFO ] [14:08:24] org.quartz.simpl.RAMJobStore - RAMJobStore initialized.
[INFO ] [14:08:24] org.quartz.core.QuartzScheduler - Scheduler meta-data: Quartz Scheduler (v1.8.6) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED'
  Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
  NOT STARTED.
  Currently in standby mode.
  Number of jobs executed: 0
  Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
  Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.

[INFO ] [14:08:24] org.quartz.impl.StdSchedulerFactory - Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
[INFO ] [14:08:24] org.quartz.impl.StdSchedulerFactory - Quartz scheduler version: 1.8.6
[INFO ] [14:08:24] org.eclipse.jetty.server.AbstractConnector - Started SelectChannelConnector@0.0.0.0:80
Starting Complete. Welcome To The JFinal World :)
 
部分源代码如下:
public class JFWebConfig extends JFinalConfig{
    Routes routes;
    private DruidPlugin druid = null;
    public void configPlugin(Plugins me) {
        loadPropertyFile("classes/datasources.txt");
        druid = new DruidPlugin(getProperty("jdbcUrl"), getProperty("user"),
                getDecryptStr(getProperty("password"), getProperty("decrypt")),
                getProperty("driverClass"), getProperty("filters"));
        druid.setValidationQuery("select 1 from dual");
        druid.setMaxActive(200);
        druid.setPoolPreparedStatements(true);
        me.add(druid);

        // 添加自动绑定model与表插件
        AutoTableBindPlugin atbp = new AutoTableBindPlugin(druid,
                SimpleNameStyles.LOWER);
        atbp.autoScan(false);// 自动扫描
        atbp.addExcludeClasses(BaseModel.class);// 忽略不想自动扫描的Model
        atbp.setShowSql(true);
        atbp.setDialect(new OracleDialect());// 配置Oracle方言
        atbp.setContainerFactory(new CaseInsensitiveContainerFactory());// 配置属性名(字段名)大小写 不敏感容器工厂

        // 加载Shiro插件
        me.add(new ShiroPlugin(routes));
        me.add(atbp);   
    }

}

如果注释掉me.add(atbp);   启动就非常快。但是因为model和table没有绑定,登陆提示空指针异常。
查了好久不知道什么原因造成的,非常希望你抽空能回答一下,非常感谢!
整儿程序是能正常启动的,就是启动时间非常久。

加载中
返回顶部
顶部