spring错误: cannot convert from ClassPathXmlApplicationContext to ApplicationContext

1.对于低版本的Eclipse
原因:import包错误,要import下面两个包
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
2.如果没引错包,同时出现错误
The type org.springframework.context.support.AbstractApplicationContext cannot be resolved. It is indirectly referenced from required .class files错误
说明,java运行环境与spring要求的jdk版本不匹配,把spring的版本改成低版本即可。
对于maven来说,在pom.xml中修改version标签,改成低版本即可。

发布了41 篇原创文章 · 获赞 1 · 访问量 4747

猜你喜欢

转载自blog.csdn.net/tomorrow_shoe/article/details/94486534