要用ApplicationContext,你用是BeanFactory吧

解决方案 »

  1.   

    Servlet action is not available是因为newRewardAssignmentLink没有正确生成,导致Struts找不到对应的Spring对象。而你做的修改仅对newRewardAssignmentLink的userService进行了proxy。由此看估计是userService生成不正确。我不知道你的那种Interceptor写得是不是有问题。我的拦截器一般采用实现MethodBeforeAdvice等接口来处理的。而不是实现MethodInterceptor:
    public class LoginInterceptor implements MethodBeforeAdvice { private static final Log logger = LogFactory.getLog(LoginInterceptor.class); private List<String> methods = new ArrayList<String>(); public void before(Method method, Object[] args, Object target) throws Throwable { boolean found = false;
    for (int i = 0; i < methods.size(); i++)
    if (methods.get(i).equals(method.getName())) { // 拦截指定的方法
    found = true;
    break;
    }
    if (!found)
    return; logger.info("called service ..... " + target.getClass().getSimpleName()); HttpSession session = ((HttpServletRequest) args[1]).getSession(); IBusinessService businessService = (IBusinessService) target;
    businessService.setRequest((HttpServletRequest) args[1]); // 刚开始调用时即设置HttpServletRequest供工具方法调用 if (businessService.getResCode() == null) // publish功能,任何均不检测
    return; if (session == null)
    throw new PrivilegeException("exception.login.operationTimeout"); SessionUserInfo sessionUserInfo = (SessionUserInfo) session.getAttribute(Constants.USER_KEY); if (sessionUserInfo == null)
    throw new PrivilegeException("exception.login.operationTimeout"); // 是否重复登陆
    if (!sessionUserInfo.getSessionId().equals(session.getId()))
    throw new PrivilegeException("exception.login.multiUser"); // 是否有权访问该模块,000资源意味着不检测权限
    if (sessionUserInfo != null && !"000".equals(businessService.getResCode())) {
    return;
    }
    } protected final Object getBean(String name) {
    return SpringContextLoaderListener.getContext().getBean(name);
    } public void setMethods(List<String> methods) {
    this.methods = methods;
    }
    }
      

  2.   

    仔细看了一下,在applicationContext.xml这个配置文件中没有找到adminService,userService 的BEAN不知你在其它文件有没有配置,
    拦截器代码 
     //取得用户Session 
             HttpSession session = request.getSession(); 
             //从Session中取得用户信息 
             User user = (User)session.getAttribute("userInfo"); 
             Byte cropUser = user.getCorpUser(); 
             Byte passPort = user.getPassPort(); 
             //如果用户为企业用户,且通过审核 
             if(cropUser.equals((byte)1) && passPort.equals((byte)1)){ 
                 //调用目标方法,继续前进 
                 return invocation.proceed(); 
             }else if (cropUser.equals((byte)1) && !passPort.equals((byte)1)) { 
     //如果是企业用户,但未通过验证 
              String noPassPort = "对不起,您没有通过验证,暂无权发布悬赏视频任务!"; 
              session.setAttribute("noPassPort", noPassPort); 
              return invocation.proceed(); //这里是否应该是用mapping.forward("");进行转发到
     }else{ 
     //如果不是企业用户 
     String notCorpUser = "对不起,只有企业用户才能发布悬赏视频任务!"; 
     session.setAttribute("notCorpUser", notCorpUser); 
     return invocation.proceed(); ////这里是否应该是用mapping.forward("");进行转发到         }        
        
        }