zoukankan      html  css  js  c++  java
  • struts2的action中@Autowired注入为null的解决方案

    今天遇到类似问题,记录下来以便以后查阅:
    @Aspect作用于action,致使action中的@Autowired注入为null的解决方案,以下三种任选一种:
    1、去掉@Autowired,改用set,get注入
    2、将action纳入spring的ioc管理(struts.objectFactory = org.apache.struts2.spring.StrutsSpringObjectFactory)
    3、修改Struts.xml文件的属性,使自动注入总是有效

    Tip:必须在所有使用了dao的地方,包括调用它的servcie都要进行@Autowired注入,否则之后的注入就会失败..

  • 相关阅读:
    UIAlertView
    网络请求ASIhttp
    省份城市选择
    Certificates
    UTF8
    xcode增加注释插件
    常用片段 button Label
    开发铺助工具
    iOS UI框架
    iOS 引导页
  • 原文地址:https://www.cnblogs.com/jpfss/p/7444916.html
Copyright © 2011-2022 走看看