解决方案 »

  1.   

    话说,因为你web.xml配置了自动扫描,而程序启动没有这一步?
      

  2.   

    废话啊,你以为ContextLoaderListener是吃素的啊,你以为contextConfiguration配置是玩的啊。
      

  3.   

    你在配置文件中都注入了,为什么又使用注解再注入一遍呢?
    使用注解的话,你配置Classpath扫描了吗
      

  4.   

    你的spring配置文件中添加了扫描注解了吗?
      

  5.   

    @Resource改为
    @Autowire
    @Qualifier("userDao")试试 
    另外你的 
    <context>
      <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:applicationContext.xml</param-value>
    </context>
    你把classpath后的*去了 看看
      

  6.   

    spring都用到了4.0的版本了,牛啊
      

  7.   

    知道原因了,是没有将struts2交给spring管理,在struts.xml配置上加上<constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory" />可以解决!