用构造器注入:
<bean id="a" class="A">
   <constructor-arg type="HttpServletRequest" value="request"/>
</bean>

解决方案 »

  1.   

    先谢谢大虾了,但是我这里还是报错啊
    我把错误贴出来
    这个selectProcess就是上面我说的那个类A
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/getAdminInfoAction' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Cannot resolve reference to bean 'selectProcessing' while setting bean property 'selectProcess'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'selectProcessing' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.servlet.http.HttpServletRequest]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments?
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'selectProcessing' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [javax.servlet.http.HttpServletRequest]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments?