I have the following defined.
@Autowired
DaoType1<object1> someDao;
@Autowired
DaoType1<object1> someListDao;
and in my bean definitions i have two beans of the same type
<bean id="someDao" class="com.example.DaoType1" />
<bean id="someListDao" class="com.example.DaoType1" />
The second bean is imported from another XML file, if that matters. They also have different properties. Why spring does not throw an error since 2 beans of the same type are defined. Does this use variable names since they match bean identifiers. The tao are different and the functionality works as expected if I used @Qualifiers for two different beans.
Here is a shorter version. I left the other beans, as I do not mean.
applicationContext.xml
<import resource="classpath:dm-services-crud.xml"/>
<bean id="ruleListCrudService" class="com.idna.dm.service.crud.impl.RuleCrudServiceImpl">
<property name="crudDao" ref="ruleListCrudDao" />
</bean>
de services crud.xml
<bean id="ruleCrudService" class="com.idna.dm.service.crud.impl.RuleCrudServiceImpl">
<property name="crudDao" ref="ruleCrudDao" />
<property name="ruleNetworkOfNodesCrudService" ref="ruleNetworkOfNodesCrudService" />
<property name="elementMappingsCrudService" ref="elementMappingsCrudService" />
<property name="ruleCrudDao" ref="newRuleCrudDao"/>
</bean>
default-autowire is generally absent in any of my xml files.
source
share