WebApplicationContext wac = null;
log.info("获取Wac begin......");
if(context == null){
log.info("context is null reutrn null");
return null;
}
String wacAttrName = (String)context.getAttribute(BuffaloPlugIn.BUFFALO_CONTEXT_PREFIX);
log.info("wacAttrName == "+wacAttrName);
if(wacAttrName != null){
wac = (WebApplicationContext)context.getAttribute(wacAttrName);
}
if(wac == null){
log.info("wac is null , obtain WebApplicationContext by WebApplicationContextUtils again");
wac = WebApplicationContextUtils.getWebApplicationContext (context);
}
return wac;
}
....//
WebApplicationContext appCtx = getWebApplicationContext (context);//WebApplicationContextUtils.getWebApplicationContext(context);
好了,修改完毕了。在Struts-config.xml中增加<plug-in className="net.buffalo.service.spring.BuffaloPlugIn" />就OK了。Web.xml中只配置
<servlet>
<servlet-name>bfapp</servlet-name>