首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SpringFrameworkUpdate5.X导致找不到org.springframework.context.SmartLifecycle的错误类文件

SpringFrameworkUpdate5.X导致找不到org.springframework.context.SmartLifecycle的错误类文件
EN

Stack Overflow用户
提问于 2022-03-10 16:37:29
回答 1查看 322关注 0票数 1

我一直在将其中一个应用程序从3.X升级到SpringFramwork5.x,其中一个问题是我未能解决它的错误,这是在使用spring-jms

无法访问org.springframework.context.SmartLifecycle错误

未找到org.springframework.context.SmartLifecycle的类文件

我可以看到最后一个版本--完全相同的代码适用于Spring4.3.9( 4.X发行版的最后一个版本)和Spring5.0.0( 5.X版本的第一个版本)。

我没有看到我的代码暴露了类SmartLifecycle,但我怀疑DefaultMessageListenerContainer实例是错误的。

代码语言:javascript
复制
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

在春季依赖关系方面,我遗漏了什么明显的东西吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-03-10 17:41:53

您需要在pom.xml中添加以下依赖项

代码语言:javascript
复制
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-context</artifactId>
  <version>5.0.0.RELEASE</version>
</dependency>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71427691

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档