Bonjour,

je ne suis pas trop familier avec Spring, et j'essaie de mettre à jour les attributs d'un de mes services via Spring.

J'ai donc un service :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
@Service("SmsService")
public class SmsServiceImpl implements SmsService {
   @Override
   public void sendSms(String text) throws Exception {
      (...)
   }
 
   private String phone;
 
   public void setPhone(String phone) {
      this.phone = phone;
   }
}
J'ai dans mon applicationContext:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
<bean id="smsService" class="[monPackage].SmsServiceImpl">
   <property name="phone"><value>06...</value></property>
</bean>
Et quand je lance un JUnit sur le service en question j'obtiens l'erreur suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'test.SmsTest': Autowiring of fields failed;
nested exception is org.springframework.beans.factory.BeanCreationException:
Could not autowire field: [monPackage].SmsService test.SmsTest.smsService;
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No unique bean of type [[monPackage].SmsService] is defined:
expected single matching bean but found 2: [SmsService, smsService]
Et quand je change la casse d'un des deux SmsService, smsService j'obtiens l'erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
expected at least 1 matching bean
Quelqu'un saurait-il d'où ça vient et comment corriger ça ?