测试Spring应用程序时出现AbstractMethodError

时间:2018-12-18 16:34:55

标签: java spring junit spring-bean

我在进行测试时遇到问题。我有一个具有某些逻辑的类,并且能够从服务器上已部署的版本中使用该类的方法。

基本上,方法采用数组的参数,其中包括属性列表。

我正在编写测试并通过JUnit执行测试,该测试使用相同的参数调用相同的方法。尽管方法和参数相同,但是我从第三方库获得了一个非常奇怪的例外。

java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myBean' defined in class path resource [mySpringContext.xml]: Initialization of bean failed; nested exception is java.lang.AbstractMethodError: com.tars.common.implementation.DeliveryProperty.isSingleton()Z
            at ..
        ....
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myBean' defined in class path resource [mySpringContext.xml]: Initialization of bean failed; nested exception is java.lang.AbstractMethodError: com.tars.common.implementation.DeliveryProperty.isSingleton()Z
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)
            at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
            at com.tars.common.MySpringContext.startcontext(MySpringContext.java:72)

为什么我总是会收到此错误,但是我可以在服务器上使用相同的参数执行相同的方法?有什么问题吗?

0 个答案:

没有答案