我有一个struts2.2和春季3.1的应用程序,我想禁用弹簧自动装配.我google了一下,发现我必须放在<beans>标签上default-autowire="no",但这似乎不起作用.
然后我知道我可以为每个<bean>标签声明这个:<bean autowire="no">,但这似乎也不起作用.
当我启用spring debug logger时,我可以看到很多这样的消息:
INFO:DEBUG [http-thread-pool-8080(3)](ConstructorResolver.java:739) - 通过构造函数将bean名称'com.common.actions.PopupAction'的类型自动装配到名为'intermedService'的bean
applicationConfig.xml中的相应条目是:
<beans default-autowire="no"
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<bean id="PopupAction" scope="prototype" class="com.common.actions.PopupAction" autowire="no">
<constructor-arg type="com.common.services.abs.iIntermedService" ref="intermedService"/>
<constructor-arg type="com.common.services.abs.iLocationService" ref="locationService"/>
<constructor-arg type="com.common.services.abs.iUserService" ref="userService"/>
<constructor-arg type="com.common.services.abs.iPhoneService" ref="phoneService"/>
</bean>
Run Code Online (Sandbox Code Playgroud)
为什么春天尝试自动装配这个动作,只要我在这里定义了依赖并且我定义了auto-wire="no"?
或者这条消息告诉我接线是通过类型通过构造函数(我想要的)和"按类型自动装配"来表示从4个参数中他将mediumService与我的变量中间服务匹配(而不是按顺序或其他) ?