我正在尝试通过构造函数自动装配一个类。
@Component
public class Test<T extends Something>{
@Autowired
public Test(Class<T> entity)
doSomething(enity);
}
...
当我运行代码时,我不断收到错误消息
Parameter 0 of constructor in com.test.Test required a bean of type 'java.lang.Class' that could not be found.
Action:
Consider defining a bean of type 'java.lang.Class' in your configuration.
有人可以告诉我这里哪里出错了。谢谢。
慕容森
相关分类