ControllerRunner的执行顺序

ControllerRunner's Execution order

这是activeweb2.0源码

protected void run(Route route) throws Exception {
    Configuration.injectFilters(); //no worries, will execute once, as filters have a life span of the app
    try {
        try { //nested try , a bit ugly, but we need to ensure filter.after() methods are executed.
            filterBefore(route);
            executeController(route);
        } finally {
            filterAfter(route);
        }
    }
    catch(ActionNotFoundException e){
        throw e;
    }
    catch (RuntimeException e) {
        RequestContext.setControllerResponse(null);//must blow away, as this response is not valid anymore.

        if (exceptionHandled(e, route)) {
            LOGGER.debug("A filter has called render(..) method, proceeding to render it...");
            renderResponse(route);//a filter has created an instance of a controller response, need to render it.
        }else{
            throw e;//if exception was not handled by filter, re-throw
        }
    }
}

如果 executeController 中发生 DBException,数据库连接将是 closed.then rollbackTransaction 将不会 executed.so 数据库将有一些错误结果

你是对的。此问题已在以下时间报告并修复:https://github.com/javalite/activeweb/issues/389

请升级到 version 2.2 以获得正确的行为。