我一直在將其中一個應用程式從 3.X 升級到 spring 框架 5.X,我無法解決的問題之一是以下錯誤 - 這利用spring-jms
無法訪問 org.springframework.context.SmartLifecycle
的 org.springframework.context.SmartLifecycle [錯誤] 類檔案未找到
我可以看到最后一個版本,完全相同的代碼適用于Spring 4.3.9(4.X 版本的最后一個版本)并與Spring 5.0.0(5.X 版本的第一個版本)一起使用
我沒有看到我的代碼暴露了類SmartLifecycle,但我懷疑DefaultMessageListenerContainer實體有問題。
public class Factory {
private DefaultMessageListenerContainer testListnerService;
public void start() {
final TestMessageListener testMessageListener = new TestMessageListener();
testListnerService = new DefaultMessageListenerContainer(); <-- This is where compilation breaks
testListnerService.setMessageListener(testMessageListener);
testListnerService.setSessionTransacted(true);
testListnerService.afterPropertiesSet();
}
我在這里創建了最小的示例https://github.com/milandesai47/com.jms.test/blob/master/pom.xml#L33
在彈簧依賴方面,我是否遺漏了任何明顯的東西?
uj5u.com熱心網友回復:
您需要將以下依賴項添加到您的pom.xml:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.0.RELEASE</version>
</dependency>
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/441884.html
