Ho scritto un test in cui ho specificato la posizione del contesto dell'applicazione con le annotazioni. Poi eseguo l'autowire del mio dao nel test.NoSuchMethodError with Spring MutableValues
@ContextConfiguration(locations = {"file:service/src/main/webapp/WEB-INF/applicationContext.xml"})
public class MyTest extends AbstractTestNGSpringContextTests {
@Autowired
protected MyDao myDao;
private PlatformTransactionManager transactionManager;
private TransactionTemplate transactionTemplate;
@Test
public void shouldSaveEntityToDb() {
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(TransactionStatus status) {
Entity entity = new Entity();
//test
myDao.save(entity)
//assert
assertNotNull(entity.getId());
}
});
}
quando ho eseguito il test io ottenere un'eccezione in cui si afferma che il contesto di applicazione non può essere caricato e si riduce a:
Caused by: java.lang.NoSuchMethodError: org.springframework.beans.MutablePropertyValues.add(Ljava/lang/String;Ljava/lang/Object;)Lorg/springframework/beans/MutablePropertyValues;
Non ho idea di dove cominciare a guardare, perché farlo ottengo questo errore e come posso risolverlo? Info springframework 3.0.2.RELEASE, Hibernate 3.4.0.GA, test 5.9
Grazie!
Si è corretto, ho avuto una dipendenza da Spring 2.5.6 nel mio progetto. – jakob