It is indirectly referenced from required .class file 错误解析。。。。

有时候在变异一些类的时候出现类似It is indirectly referenced from required .class file的错误。

查询的原因可能是如下:

在spring2.0 技术手册的第4章第二节 关于Advice的实例BeforeAdviceDemo中

您会发现您书写的LogBeforeAdvice类中并未找到需继承的MethodBeforeAdvice接口,无法导入,原因为书上并未提及需要增加aop的jar包,您需要在工程/Propertise中的Java Build Path中的libraries 选项卡中添加spring-aop.jar,与下载包的路径是spring-framework-2.0.3-with-dependencies/spring-framework-2.0.3/dist/modules

添加之后,eclipse又会报出It is indirectly referenced from required .class file 的错误,其原因为Advice接口需要依赖于关于AOP标准的类,且其类并不在spring-aop.jar中,您需要再次添加依赖的包aopalliance.jar,于下载包的路径为spring-framework-2.0.3-with-dependencies/spring-framework-2.0.3/lib/aopalliance

猜你喜欢

转载自joezheng123.iteye.com/blog/1834890