RequestIocContext reqContext = null;
try {
if (null != moduleObj) {
ac.setModule(moduleObj);
} else {
Ioc ioc = ac.getIoc();
if (null == ioc)
throw Lang.makeThrow( "Moudle with @InjectName('%s') or @IocBean('%s') but you not declare a Ioc for this app",
injectName, injectName);
Object obj;
/*
* 如果 Ioc 容器实现了高级接口,那么会为当前请求设置上下文对象
*/
if (ioc instanceof Ioc2) {
reqContext = new RequestIocContext(ac.getRequest());
SessionIocContext sessionContext = new SessionIocContext(Mvcs.getHttpSession());
IocContext myContext = new ComboContext(reqContext, sessionContext);
Mvcs.setIocContext(myContext);
obj = ((Ioc2) ioc).get(moduleType, injectName, myContext);
}
/*
* 否则,则仅仅简单的从容器获取
*/
else
obj = ioc.get(moduleType, injectName);
ac.setModule(obj);
}
ac.setMethod(method);
//if (log.isDebugEnabled()) //打印实际执行的Method信息