我有在Spring 3.2.6工作,但在4.0.1自动装配不春季工作4
public interface RunTest<T extends Number> {
void run(T number);
}
public class BasicRunTest implements RunTest<Integer>{
@Override
public void run(Integer number) {
}
}
@Component
public class BeanTest {
@Autowired
private RunTest<Number> runTest;
}
如果我运行该应用程序我得到的异常不起作用以下来源例如:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.test.RunTest] 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)}
你能告诉我们您的上下文配置?你有在任何地方定义的'RunTest' bean吗? –
这会帮助你[弹簧和自动装配的泛型](http://www.jayway.com/2013/11/03/spring-and-autowiring-of-generic-types/) – EderRoger