如果配置spring时出现 It is indirectly referenced from required .class files

Posted hzh-666

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如果配置spring时出现 It is indirectly referenced from required .class files相关的知识,希望对你有一定的参考价值。

运行代码是出现如下错误信息:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    The type org.springframework.beans.BeansException cannot be resolved. It is indirectly referenced from required .class files
    The constructor ClassPathXmlApplicationContext(String) refers to the missing type BeansException
    The method getBean(String, Class<People>) is undefined for the type ApplicationContext

出错原因:是找不到相应的依赖包,所以会出现:

It is indirectly referenced from required .class files

解决办法:
在spring文件夹下spring-framework-4.1.6.RELEASE-dist\spring-framework-4.1.6.RELEASE\libs下找到spring-beans-4.1.6.RELEASE.jar包并导入就可以了

以上是关于如果配置spring时出现 It is indirectly referenced from required .class files的主要内容,如果未能解决你的问题,请参考以下文章

在 Windows XP 中使用 Indy 10 发送带有内嵌图像的电子邮件时出现“SMTP 传入数据超时”

[redis] The type org.apache.commons.pool2.impl.GenericObjectPoolConfig cannot be resolved.It is indi

使用 JDBC、spring 框架和 oracle 时出现 ORA04091-table is mutating 错误

使用spring注入时出现 XXX is not writable or has an invalid setter method

用WebStorm创建Express项目时出现:express version is unavailable

spring使用过程中遇到的问题