java - org.springframework.beans.factory.BeanCreationException 创建名为 'certificateOrderRepository' 的 bean 时出错

标签 java spring

您好,我是 spring 框架的新手,我正在尝试使用 jUnit 进行测试。每当我运行测试时,我都会遇到此错误。谁能帮帮我吗?

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'certificateOrderRepository': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'systemConfigurationDto' defined in file [E:\confidential\Global_Sign\40_Make\royaljelly-pc\target\test-classes\test-applicationContext-bean.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'mtaDto.password' of bean class [com.globalsign.hb.dto.SystemConfigurationDto]: Nested property in path 'mtaDto.password' does not exist; nested exception is org.springframework.beans.NotReadablePropertyException: Invalid property 'mtaDto' of bean class [com.globalsign.hb.dto.SystemConfigurationDto]: Bean property 'mtaDto' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:300)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at org.springframework.test.AbstractSingleSpringContextTests.createApplicationContext(AbstractSingleSpringContextTests.java:216)
    at org.springframework.test.AbstractSingleSpringContextTests.loadContextLocations(AbstractSingleSpringContextTests.java:192)
    at org.springframework.test.AbstractSingleSpringContextTests.loadContext(AbstractSingleSpringContextTests.java:172)
    at org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:133)
    at org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:101)
    at junit.framework.TestCase.runBare(TestCase.java:132)
    at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:79)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'systemConfigurationDto' defined in file [E:\confidential\Global_Sign\40_Make\royaljelly-pc\target\test-classes\test-applicationContext-bean.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'mtaDto.password' of bean class [com.globalsign.hb.dto.SystemConfigurationDto]: Nested property in path 'mtaDto.password' does not exist; nested exception is org.springframework.beans.NotReadablePropertyException: Invalid property 'mtaDto' of bean class [com.globalsign.hb.dto.SystemConfigurationDto]: Bean property 'mtaDto' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:435)
    at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:409)
    at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:541)
    at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:147)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
    at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:297)
    ... 30 more
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'mtaDto.password' of bean class [com.globalsign.hb.dto.SystemConfigurationDto]: Nested property in path 'mtaDto.password' does not exist; nested exception is org.springframework.beans.NotReadablePropertyException: Invalid property 'mtaDto' of bean class [com.globalsign.hb.dto.SystemConfigurationDto]: Bean property 'mtaDto' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:893)
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358)
    ... 43 more
Caused by: org.springframework.beans.NotReadablePropertyException: Invalid property 'mtaDto' of bean class [com.globalsign.hb.dto.SystemConfigurationDto]: Bean property 'mtaDto' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:707)
    at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:555)
    at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:532)
    at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:890)
    ... 46 more

最佳答案

    Invalid property 'mtaDto.password' of bean class [com.globalsign.hb.dto.SystemConfigurationDto]: Nested property in path 'mtaDto.password' does not exist; 

可能是密码字段正在其他地方(例如jsp中)被访问。如果没有实际的代码,很难回答。只需尝试一下,看看密码字段是否是原因所在。

关于java - org.springframework.beans.factory.BeanCreationException 创建名为 'certificateOrderRepository' 的 bean 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13060582/

相关文章:

java - 如何从 Android 上的 ListView 中删除项目

java.lang.NullPointerException : uri - Turning on Location through Alert Dialog

spring - 如何使用 Spring-Boot 的 RestTemplate 在 uri 标记中获取 http-client-requests 指标的模板化值?

java - 根据休息标准,哪个休息 API url 更好?

java - Spring 5 中 lite @Bean 方法的行为

java - 如何理解 spring boot 应用程序已准备好工作?

java - 如何将 Netbeans 项目转移到 Eclipse 中?

java - 应用程序崩溃时编辑对话框

java - 无状态 spring 应用程序 - JSESSIONID 仍然生成

java - 将项目从 JDK 1.7 切换到 1.6 BufferedReader