本帖最后由 lulei9876 于 2014-12-22 16:31:24 编辑

解决方案 »

  1.   

    楼主,我上次也遇到这种问题了。
    1.你看下你的strust配置文件 的class和spring配置文件的名字是不是一样
    2.看能不能加载到你这些的bean
    ApplicationContext ac = new ClassPathXmlApplicationContext("conf/spring/applicationContext*.xml");
     TestService   testService=(TestService) ac.getBean("TestService");
        testService.insert();
    试下有输出?
    3.代码中有没有getset方法的
      

  2.   

    <struts>
        <package name="test" extends="athink-default" namespace="/">
     
            <action name="testAction" class="TestAction" />
        </package>
    </struts>
      

  3.   

    <struts>
    <package name="test" extends="athink-default"> <action name="testAction" class="testAction" />
    </package>
    </struts>
    action后面除了name,method呢,class的路径是写的是全路径吗(com.aili......)
      

  4.   

    其实加不加不加注解注入也没用问题这里写全路径,就是strust创建了这样是没办法获得Service层的。楼主其实是想spring注入,这样写是没错的!
      

  5.   

    把extends="athink-default" 改成 extends="struts-default"
    web.xml有没有把spring,struts加进去?
      

  6.   

    spring 的注解生效应该是
    <!--启动spring注解功能 -->
    <tx:annotation-driven  />