I have an application with struts2.2 and spring 3.1 and I want to disable autwire spring. I searched googled a bit and found that I need to put in the <beans>
default-autowire="no"
, but this does not work.
Then I fount that I can declare it for each <bean>
as follows: <bean autowire="no">
, but this also does not work.
When I turned on spring debug logger, I can see many messages like:
INFO: DEBUG [http-thread-pool-8080 (3)] (ConstructorResolver.java:739) - Autowiring by type from bean name 'com.common.actions.PopupAction' through the constructor to a bean named 'Intermedservice'
and the corresponding entry in 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>
Why is spring trying to auto-install this action while I manually defined the dependency here, and I defined auto-wire="no"
?
Or this message tells me that the wiring was done by type through the constructor (as I wanted), and "Autowiring by type" means that out of 4 parameters, he matched the intermediate service with my variable, the intermediate service by type (and not in order or what something else)?
source share