Exemplo n.º 1
0
  /** 配置插件 */
  @Override
  public void configPlugin(Plugins me) {
    /** 配置Druid数据库连接池插件* */
    DruidPlugin dp =
        new DruidPlugin(
            ReadPropertity.getProperty("jdbcUrl"),
            ReadPropertity.getProperty("user"),
            ReadPropertity.getProperty("password"));
    dp.addFilter(new StatFilter());
    dp.setMaxActive(150);
    WallFilter wall = new WallFilter();
    wall.setDbType(ReadPropertity.getProperty("dbType"));
    dp.addFilter(wall);
    me.add(dp);

    /** 配置ActiveRecord插件* */
    ActiveRecordPlugin arp = new ActiveRecordPlugin(dp);
    me.add(arp);

    /** 加载EhCache插件* */
    me.add(new EhCachePlugin());

    arp.addMapping("admin", Admin.class);
    arp.addMapping("category", Category.class);
    arp.addMapping("article", Article.class);
    arp.addMapping("links", Links.class);
    arp.addMapping("website", Website.class);
    arp.addMapping("tags", Tags.class);
    arp.addMapping("gbook", Gbook.class);
  }
Exemplo n.º 2
0
 /** 配置常量 */
 @Override
 public void configConstant(Constants me) {
   boolean devMode = Boolean.parseBoolean(ReadPropertity.getProperty("devMode"));
   me.setDevMode(devMode);
   me.setViewType(ViewType.JSP);
 }