public class APP {
public static void main(String[] args) {
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
Person ps = (Person) ac.getBean("p");
ps.save();
}
}
问题描述:
Error:(4, 35) java: 程序包org.springframework.context不存在;
**
解决方案:
要把maven配置文件settings.xml中自己加的本地下载位置删除, 如果想改位置,就在idea手动修改本地仓库的配置。
找到自己电脑的Maven文件下的配置文件settings.xml
D:\Program Files\Maven\apache-maven-3.6.0\conf\settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- 删除自己添加的 localRepository 地址 -->
<!-- <localRepository>F:\Program Files\Maven\Maven下jar包库</localRepository>-->
可以用idea清空缓存,重建索引
然后刷新maven项目,问题解决!