【问题标题】:The type org.springframework.context.ApplicationContextAware cannot be resolved. It is indirectly referenced from required .class filesorg.springframework.context.ApplicationContextAware 类型无法解析。它是从所需的 .class 文件中间接引用的
【发布时间】:2013-09-19 14:45:15
【问题描述】:

编译以下代码会产生此错误:

org.springframework.context.ApplicationContextAware 类型无法解析。它是从所需的 .class 文件中间接引用的 (此错误是针对最后一行代码)

我想我应该在构建路径中添加一个.jar文件,但我不知道它是什么?

CamelContext context = new DefaultCamelContext(); 
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(ActiveMQConnection.DEFAULT_BROKER_URL);
context.addComponent("test-jms", JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));

【问题讨论】:

标签: java spring spring-mvc


【解决方案1】:

你需要添加Spring Framework

org.springframework.context-3.x.x.jar

到您项目的构建路径。根据您使用的第三方库,它可能具有额外的 Spring 依赖项,您也必须添加这些 Spring jar。你很可能也需要org.springframework.core-3.x.x.jar

查阅您的直接依赖项的文档以了解其依赖项是什么。

【讨论】: