导入包报错The import org.springframework cannot be resolved

刚开始学spring框架时import org.springframework.context.support.ClassPathXmlApplicationContext;报错

我建的是maven项目,上网查了一下,在pom.xml文件加上下面代码即可

   <dependencies>
     <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-context</artifactId>
         <version>4.3.17.RELEASE</version>
     </dependency>
   </dependencies>

注意,要放在<bulid>外面,添加后右键项目->Maven->Update Project就完成。

文章里如果有错误的地方还望朋友指出,谢谢
原文地址:https://www.cnblogs.com/dqccc/p/12586367.html