Neither GenericXmlContextLoader nor AnnotationConfigContextLoader was able to detect defaults for context configuration


Problem: Running JUnit 4 with Spring 3 and getting below exception

 

Neither GenericXmlContextLoader nor AnnotationConfigContextLoader was able to detect defaults for context configuration

 

Solution: Add locations attribute to the contextConfiguration.

@ContextConfiguration(locations = {“classpath:applicationContext.xml”}) for the JUnit to refer to the beans Definition.

 

 

  1. Leave a comment

Leave a comment