The import org.springframework cannot be resolved 相关问题

使用eclipse导入本地一个java项目时遇到了相关问题,首先是:The import org.springframework cannot be resolved;解决方法:

  maven项目: 在maven中的pom.xml文件中添加代码所示的第二个依赖项spring-test即可,
  添加后右键项目->Maven->Update Project就完成。
  
    
		
			org.springframework
			spring-context
			4.3.17.RELEASE
		
	
	非maven项目:在Eclipse中,右击项目,选择Build Path->configure build path->Libraries->Add External JARs,
	找到你计算机中spring-context相关jar包,选中它之后,添加点击“确定”即可,我这里是spring-context-4.1.9.RELEASE.jar
	如下图:

The import org.springframework cannot be resolved 相关问题_第1张图片

另一个问题:The type org.springframework.beans.factory.support.BeanNameGenerator cannot be resolved. It is indirectly referenced from required .class files,从这句话意思来看是缺少org.springframework.beans相关得jar包,重复上述操作,找到org.springframework.beans相关jar包,引入即可。

总结/个人理解:The import “xxx” cannot be resolved相关问题,即为"xxx"相关的依赖缺失,引入相关的jar包即可。

你可能感兴趣的:(java,maven)