I have following test class:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:ApplicationContext.xml")
public class CompoundServiceImplTest {
    @Autowired
    @Qualifier("testCompoundService")
    private TestCompoundService testCompoundService;
    //...
}
and ApplicationContext contains:
<bean id="testCompoundService"  autowire="byType"
      class="myPackage.TestCompoundService">
</bean>
If also tried autowire byName or leaving @Qualifier away (I added that because it did not work but that did not help either).
I get following exception:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: 
    No matching bean of type [myPackage.TestCompoundService] found for dependency: 
        expected at least 1 bean which qualifies as autowire candidate for this dependency. 
        Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true),
        @org.springframework.beans.factory.annotation.Qualifier(value=testCompoundService)}
The bean is clearly configure yet spring claims it isn't?
How can i solve this?
EDIT:
When I change @Autowired to @Resource I get following error:
Injection of resource dependencies failed; 
    nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: 
    Bean named 'testCompoundService' must be of type [myPackage.TestCompoundService], 
    but was actually of type [$Proxy68]
