为什么通过注解装配就是找不到那个对象,xml装配的就可以运行显示
收起
你的上下文是xml的applicationContext,无法获取到注解的bean
要么使用@Autowired 或者@Resource 直接注入bean。
@Autowired private Student student;
要么使用ApplicationContextAware,通过上下文获取
报告相同问题?