Error creating bean with name 'productService' defined in class path resource
具體錯(cuò)誤如圖
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'productService' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'productDao' of bean class [cn.cheng.ssh.service.ProductService]: Bean property 'productDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
?? ?at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1568)
?? ?at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276)
?? ?at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
?? ?at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
?? ?at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
?? ?at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
?? ?at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
?? ?at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
?? ?at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
?? ?at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
?? ?at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
?? ?at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
?? ?at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
?? ?at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
?? ?at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4754)
?? ?at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5216)
?? ?at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
?? ?at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
?? ?at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
?? ?at java.util.concurrent.FutureTask.run(Unknown Source)
?? ?at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
?? ?at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
?? ?at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'productDao' of bean class [cn.cheng.ssh.service.ProductService]: Bean property 'productDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
?? ?at org.springframework.beans.BeanWrapperImpl.createNotWritablePropertyException(BeanWrapperImpl.java:243)
?? ?at org.springframework.beans.AbstractNestablePropertyAccessor.processLocalProperty(AbstractNestablePropertyAccessor.java:437)
?? ?at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:292)
?? ?at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:280)
?? ?at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:95)
?? ?at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
?? ?at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1564)
?? ?... 22 more
2022-03-23
應(yīng)該是喝車(chē)別開(kāi)酒剛翻手冊(cè)看到首字母大寫(xiě)的ucfirst()函數(shù),但又考慮到控制器名字可能有多個(gè)單詞例如songlist...,所以命名時(shí)還是拋棄大寫(xiě)的這種規(guī)范吧
2017-12-14
你好,我也是這個(gè)問(wèn)題,你解決了么?
2017-04-08
有jar包嗎
2017-04-07
在applicationContext的xml文件中,找到配置的Action類(lèi),Crtl+右鍵點(diǎn)一下屬性名和參照,看能否跳轉(zhuǎn),尤其是id要和dao,service或者action中的私有變量名稱要一致。
2017-04-07
在applicationContext的xml文件中,找到配置的Action類(lèi),Crtl+右鍵點(diǎn)一下屬性名和參照,看能否跳轉(zhuǎn),尤其是id要和dao,service或者action中的私有變量名稱要一致。