Skip to content

Commit

Permalink
update: 测试一下拦截器的注入
Browse files Browse the repository at this point in the history
  • Loading branch information
wendal committed Sep 6, 2016
1 parent 2fbff12 commit 89178e0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/config/dao-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,12 @@ var ioc = {
type :"org.nutz.dao.impl.NutDao",
args : [ {refer :"dataSource"}, {refer :"sqls"} ],
fields : {
interceptors : ["log", "time"]
interceptors : ["log", "time", {refer:"dao_sayhi"}]
}
},
dao_sayhi : {
type : "org.nutz.dao.impl.interceptor.SayHiDaoInterceptor"
},
/*------------------------------------------------------------------*/
// Sqls
sqls : {
Expand Down
19 changes: 19 additions & 0 deletions test/org/nutz/dao/impl/interceptor/SayHiDaoInterceptor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.nutz.dao.impl.interceptor;

import org.nutz.dao.DaoException;
import org.nutz.dao.DaoInterceptor;
import org.nutz.dao.DaoInterceptorChain;
import org.nutz.log.Log;
import org.nutz.log.Logs;

public class SayHiDaoInterceptor implements DaoInterceptor {

private static final Log log = Logs.get();

@Override
public void filter(DaoInterceptorChain chain) throws DaoException {
log.debug("nop ...");
chain.doChain();
}

}

0 comments on commit 89178e0

Please sign in to comment.