Hi
I have this class:
and this spring config:Code:public class AccountMailCredentialRecoveryManager extends AbstractUserCredentialRecoveryManager<Account> { @Inject protected AccountService accountService; @Inject private TemplateMailService mailService; public void setAccountService(AccountService accountService) { this.accountService = accountService; } public void setMailService(TemplateMailService mailService) { this.mailService = mailService; } }
This results in:Code:<bean id="CredentialRecoveryManager" class="ch.imis.ishop.authentication.AccountMailCredentialRecoveryManager"> <property name="credentialEncryptor" ref="SaltCredentialEncryptor" /> <property name="accountService" ref="AccountService" /> <property name="messageTranslator" ref="MessageTranslator" /> <property name="mailService" ref="CredentialRecoveryTemplateMailService" /> </bean>
Because there are other beans with the interface TemplateMailService. If I remove the @Inject it works. Is it the purpose that @Inject wins over the explicit property injection in the config file, or is this a bug?Code:Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private ch.imis.ishop.mail.TemplateMailService ch.imis.ishop.authentication.AccountMailCredentialRecoveryManager.mailService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [ch.imis.ishop.mail.TemplateMailService] is defined: expected single matching bean but found 5: [CredentialRecoveryTemplateMailService, templateMailService, registrationConfirmationMailService, efcoRegisterationMailService, RecommendationMailService]
greez
GarfieldKlon



Reply With Quote