编译以下代码会产生此错误:
The type org.springframework.context.ApplicationContextAware cannot be resolved. It is indirectly referenced from required .class files (this error is for last line of code)
我想我应该在构建路径中添加一个 .jar 文件,但我不知道它是什么?
CamelContext context = new DefaultCamelContext();
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(ActiveMQConnection.DEFAULT_BROKER_URL);
context.addComponent("test-jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
最佳答案
您需要添加 Spring Framework的
org.springframework.context-3.x.x.jar
到您项目的构建路径。根据您使用的第三方库,它可能具有额外的 Spring 依赖项,您也必须添加这些 Spring jar。您很可能还需要 org.springframework.core-3.x.x.jar
。
查阅您的直接依赖项的文档以找出它的依赖项是什么。
关于java - 无法解析类型 org.springframework.context.ApplicationContextAware。它是从所需的 .class 文件中间接引用的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18811276/