我正在使用 Spring boot,并且想要使用启动器 pom 进行 Spring Integration。
在我的 POM 中,我有:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.3.RELEASE</version>
<relativePath/>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
这会引入 4.3.6 版本的 Spring Integration jar 和 4.3.5 版本的 Spring Framework jar。在我自己的一个类中,我尝试使用消息:
import org.springframework.integration.Message;
public Object doThings(Message<?> message) {
}
但我似乎找不到消息。在旧版本的 Spring 集成中,它位于 spring-integration-core.jar 中,但在此版本中不存在。它移动了或者发生了一些变化吗?我已经检查了文档,它仍然被引用,所以我认为我找错了地方 - 但核心听起来像是它应该在我的地方!我做错了什么?
最佳答案
Spring Integration 的一些核心概念已在 3.0 和 4.0 版本之间合并到 Spring Core 中,org.springframework.integration.Message
就是其中之一。
在您的代码示例中,替换
import org.springframework.integration.Message;
public Object doThings(Message<?> message) {
}
由
import org.springframework.messaging.Message;
public Object doThings(Message<?> message) {
}
就可以了。
有关受影响的类和接口(interface)的更详尽列表,请查看 the 3.0 to 4.0 Spring Integration migration guide
关于java - 使用 spring-boot-starter-integration 时找不到 org.springframework.integration.Message,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41717366/