autowire

@Autowired annotation not working

I'm trying to test the Autowire option like this: @ContextConfiguration(locations = { "classpath:applnContext.xml" }) public class Foo { @Autowired private Bar bar; public Bar getBar() { return bar; } public void setBar(final Bar bar) { this.bar = bar; } public static void main(final String...

Spring autowire not behaving as expected

I have tried to autowire a bean for a test class using @Autowire, however the bean is not wired and I get this exception: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.abc.MyDaoHibernateImpl] found for dependency: expected at least 1 bean which qualifies as autowire c...