Error creating bean with name ‘poolconfig‘ defined in class path resource [applicationContext-jedis.

博客内容讲述了在使用Spring与Jedis集成时遇到的Bean创建异常,问题源于spring-context和spring-beans版本过高。解决方案是将这两个库的版本降低到4.1.3.RELEASE,从而解决了NoSuchMethodError。作者强调了版本匹配在编程中的重要性,并表示在学习过程中会持续努力。
摘要由CSDN通过智能技术生成

Error creating bean with name ‘poolconfig’ defined in class path resource [applicationContext-jedis.xml]:

报的错误:
D:\JAVA1\jDK1.8\bin\java.exe “-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.2.3\lib\idea_rt.jar=55707:C:\Program Files\JetBrains\IntelliJ IDEA 2020.2.3\bin” -Dfile.encoding=UTF-8 -classpath D:\JAVA1\jDK1.8\jre\lib\charsets.jar;D:\JAVA1\jDK1.8\jre\lib\deploy.jar;D:\JAVA1\jDK1.8\jre\lib\ext\access-bridge-64.jar;D:\JAVA1\jDK1.8\jre\lib\ext\cldrdata.jar;D:\JAVA1\jDK1.8\jre\lib\ext\dnsns.jar;D:\JAVA1\jDK1.8\jre\lib\ext\jaccess.jar;D:\JAVA1\jDK1.8\jre\lib\ext\jfxrt.jar;D:\JAVA1\jDK1.8\jre\lib\ext\localedata.jar;D:\JAVA1\jDK1.8\jre\lib\ext\nashorn.jar;D:\JAVA1\jDK1.8\jre\lib\ext\sunec.jar;D:\JAVA1\jDK1.8\jre\lib\ext\sunjce_provider.jar;D:\JAVA1\jDK1.8\jre\lib\ext\sunmscapi.jar;D:\JAVA1\jDK1.8\jre\lib\ext\sunpkcs11.jar;D:\JAVA1\jDK1.8\jre\lib\ext\zipfs.jar;D:\JAVA1\jDK1.8\jre\lib\javaws.jar;D:\JAVA1\jDK1.8\jre\lib\jce.jar;D:\JAVA1\jDK1.8\jre\lib\jfr.jar;D:\JAVA1\jDK1.8\jre\lib\jfxswt.jar;D:\JAVA1\jDK1.8\jre\lib\jsse.jar;D:\JAVA1\jDK1.8\jre\lib\management-agent.jar;D:\JAVA1\jDK1.8\jre\lib\plugin.jar;D:\JAVA1\jDK1.8\jre\lib\resources.jar;D:\JAVA1\jDK1.8\jre\lib\rt.jar;D:\mycode\spring-jedis\target\classes;D:\rep\redis\clients\jedis\3.3.0\jedis-3.3.0.jar;D:\rep\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;D:\rep\org\apache\commons\commons-pool2\2.6.2\commons-pool2-2.6.2.jar;D:\rep\org\springframework\spring-context\5.2.5.RELEASE\spring-context-5.2.5.RELEASE.jar;D:\rep\org\springframework\spring-aop\5.2.5.RELEASE\spring-aop-5.2.5.RELEASE.jar;D:\rep\org\springframework\spring-core\5.2.5.RELEASE\spring-core-5.2.5.RELEASE.jar;D:\rep\org\springframework\spring-jcl\5.2.5.RELEASE\spring-jcl-5.2.5.RELEASE.jar;D:\rep\org\springframework\spring-expression\5.2.5.RELEASE\spring-expression-5.2.5.RELEASE.jar;D:\rep\org\springframework\spring-beans\5.1.3.RELEASE\spring-beans-5.1.3.RELEASE.jar com.hao.Test
SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread “main” org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘poolconfig’ defined in class path resource [applicationContext-jedis.xml]: Post-processing of merged bean definition failed; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.annotation.InjectionMetadata.forElements(Ljava/util/Collection;Ljava/lang/Class;)Lorg/springframework/beans/factory/annotation/InjectionMetadata;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:144)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:85)
at com.hao.Test.testSpringJedisSingle(Test.java:15)
at com.hao.Test.main(Test.java:9)
Caused by: java.lang.NoSuchMethodError: org.springframework.beans.factory.annotation.InjectionMetadata.forElements(Ljava/util/Collection;Ljava/lang/Class;)Lorg/springframework/beans/factory/annotation/InjectionMetadata;
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.buildResourceMetadata(CommonAnnotationBeanPostProcessor.java:452)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.findResourceMetadata(CommonAnnotationBeanPostProcessor.java:363)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:311)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1044)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:550)
… 12 more

Process finished with exit code 1

<dependencies>
        <!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>3.3.0</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>5.1.3.RELEASE</version>
        </dependency>

    </dependencies>

原因是我的spring-context和spring-beans的坐标的版本太高的了换成4.1.3.RELEASE就好了,学习的路上一直再坚持。

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值