org.springframework.beans.factor…

来源:互联网 发布:滴滴截图造假软件 编辑:程序博客网 时间:2024/06/05 14:16
Exception in thread "main"org.springframework.beans.factory.BeanCreationException: Errorcreating bean with name 'boss' defined in class path resource[xiao/lei/entity/beans.xml]: Error setting property values; nestedexception isorg.springframework.beans.NotWritablePropertyException: Invalidproperty 'office' of bean class [xiao.lei.entity.Boss]: Beanproperty 'office' is not writable or has an invalid setter method.Does the parameter type of the setter match the return type of thegetter?
    atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1353)
    atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)
    atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    atorg.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)
    atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    atorg.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
    atorg.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93)
    atxiao.lei.test.AnnoloCTest.main(AnnoloCTest.java:16)
Caused by: org.springframework.beans.NotWritablePropertyException:Invalid property 'office' of bean class [xiao.lei.entity.Boss]:Bean property 'office' is not writable or has an invalid settermethod. Does the parameter type of the setter match the return typeof the getter?
    atorg.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1016)
    atorg.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:896)
    atorg.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
    atorg.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
    atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1350)
    ... 13more
错误原因是:Boss类中缺少属性的set/get方法
public class Boss {
    privateOffice office;
   @Override
    publicString toString() {
      return  "office:" + office;
    }

}
0 0
原创粉丝点击