Error creating Bean with Name ' UserService ' appears in Spring+springmvc+myibatic:

Source: Internet
Author: User
Tags addchild
I showed up in the building spring+springmvc+myibatic.
Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' UserService ': injection of autowired dependencies failed; Nested exception is org.springframework.beans.factory.BeanCreationException:Could not autowire field: Com.test.dao.UserDao Com.test.service.UserService.userDao; Nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:No matching bean of type [ Com.test.dao.UserDao] found for dependency:expected at least 1 beans which qualifies as Autowire candidate for this depend Ency. Dependency annotations: {@org. springframework.beans.factory.annotation.Autowired (Required=true)}
Related Cause:org.springframework.beans.factory.BeanCreationException:Error creating bean with Name ' Userdao ': Injection of autowired dependencies failed; Nested exception is org.springframework.beans.factory.BeanCreationException:Could not autowire method:public void Org.mybatis.spring.mapper.MapperFactoryBean.setSqlSessionFactory (org.apache.ibatis.session.SqlSessionFactory); Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' Sqlsessionfactory ' defined in ServletContext resource [/web-inf/classes/config/applicationcontext.xml]: Error setting property values; Nested exception is Org.springframework.beans.NotWritablePropertyException:Invalid property ' Typealiasespackage ' of Bean class [Org.mybatis.spring.SqlSessionFactoryBean]: Bean property ' typealiasespackage ' are not writable or have an Invali D Setter method. Does the parameter type of the setter match the return type of the getter?
At Org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues ( autowiredannotationbeanpostprocessor.java:287)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean ( abstractautowirecapablebeanfactory.java:1106)
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:294)
At Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:225)
At Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:291)
At Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:193)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons ( defaultlistablebeanfactory.java:585)
At Org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization ( abstractapplicationcontext.java:913)
At Org.springframework.context.support.AbstractApplicationContext.refresh (abstractapplicationcontext.java:464)
At Org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext (Contextloader.java : 385)
At Org.springframework.web.context.ContextLoader.initWebApplicationContext (contextloader.java:284)
At Org.springframework.web.context.ContextLoaderListener.contextInitialized (contextloaderlistener.java:111)
At Org.apache.catalina.core.StandardContext.listenerStart (standardcontext.java:4994)
At Org.apache.catalina.core.StandardContext.startInternal (standardcontext.java:5492)
At Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:150)
At Org.apache.catalina.core.ContainerBase.addChildInternal (containerbase.java:901)
At Org.apache.catalina.core.ContainerBase.addChild (containerbase.java:877)
At Org.apache.catalina.core.StandardHost.addChild (standardhost.java:649)
At Org.apache.catalina.startup.HostConfig.deployDirectory (hostconfig.java:1245)
At Org.apache.catalina.startup.hostconfig$deploydirectory.run (hostconfig.java:1895)
At Java.util.concurrent.executors$runnableadapter.call (Unknown Source)
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.factory.BeanCreationException:Could not autowire Field:com.test.dao.UserDao Com.test.service.UserService.userDao; Nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:No matching bean of type [ Com.test.dao.UserDao] found for dependency:expected at least 1 beans which qualifies as Autowire candidate for this depend Ency. Dependency annotations: {@org. springframework.beans.factory.annotation.Autowired (Required=true)}
At org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$ Autowiredfieldelement.inject (autowiredannotationbeanpostprocessor.java:506)
At Org.springframework.beans.factory.annotation.InjectionMetadata.inject (injectionmetadata.java:87)
At Org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues ( autowiredannotationbeanpostprocessor.java:284)
... More
caused by:org.springframework.beans.factory.NoSuchBeanDefinitionException:No matching bean of type [ Com.test.dao.UserDao] found for dependency:expected at least 1 beans which qualifies as Autowire candidate for this depend Ency. Dependency annotations: {@org. springframework.beans.factory.annotation.Autowired (Required=true)}
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException ( defaultlistablebeanfactory.java:924)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency ( defaultlistablebeanfactory.java:793)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency ( defaultlistablebeanfactory.java:707)
At org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$ Autowiredfieldelement.inject (autowiredannotationbeanpostprocessor.java:478)
... More
Related cause:
Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' Userdao ': injection of autowired dependencies failed; Nested exception is org.springframework.beans.factory.BeanCreationException:Could not autowire method:public void Org.mybatis.spring.mapper.MapperFactoryBean.setSqlSessionFactory (org.apache.ibatis.session.SqlSessionFactory); Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' Sqlsessionfactory ' defined in ServletContext resource [/web-inf/classes/config/applicationcontext.xml]: Error setting property values; Nested exception is Org.springframework.beans.NotWritablePropertyException:Invalid property ' Typealiasespackage ' of Bean class [Org.mybatis.spring.SqlSessionFactoryBean]: Bean property ' typealiasespackage ' are not writable or have an Invali D Setter method. Does the parameter type of the setter match the return type of the getter?
At Org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues ( autowiredannotationbeanpostprocessor.java:287)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean ( abstractautowirecapablebeanfactory.java:1106)
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:294)
At Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:225)
At Org.springframework.beans.factory.support.
Abstractbeanfactory.dogetbean (abstractbeanfactory.java:291)
At Org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean (Abstractbeanfactory.java : 1356)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean ( abstractautowirecapablebeanfactory.java:710)
At Org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch (abstractbeanfactory.java:519)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType ( defaultlistablebeanfactory.java:319)
At Org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors (Beanfactoryutils.java : 185)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates ( defaultlistablebeanfactory.java:833)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency ( defaultlistablebeanfactory.java:790)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency ( defaultlistablebeanfactory.java:707)
At org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$ Autowiredfieldelement.inject (autowiredannotationbeanpostprocessor.java:478)
At Org.springframework.beans.factory.annotation.InjectionMetadata.inject (injectionmetadata.java:87)
At Org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues ( autowiredannotationbeanpostprocessor.java:284)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean ( abstractautowirecapablebeanfactory.java:1106)
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:294)
At Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:225)
At Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:291)
At Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:193)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons ( defaultlistablebeanfactory.java:585)
At Org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization ( abstractapplicationcontext.java:913)
At Org.springframework.context.support.AbstractApplicationContext.refresh (abstractapplicationcontext.java:464)
At Org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext (Contextloader.java : 385)
At Org.springframework.web.context.ContextLoader.initWebApplicationContext (contextloader.java:284)
At Org.springframework.web.context.ContextLoaderListener.contextInitialized (contextloaderlistener.java:111)
At Org.apache.catalina.core.StandardContext.listenerStart (standardcontext.java:4994)
At Org.apache.catalina.core.StandardContext.startInternal (standardcontext.java:5492)
At Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:150)
At Org.apache.catalina.core.ContainerBase.addChildInternal (containerbase.java:901)
At Org.apache.catalina.core.ContainerBase.addChild (containerbase.java:877)
At Org.apache.catalina.core.StandardHost.addChild (standardhost.java:649)
At Org.apache.catalina.startup.HostConfig.deployDirectory (hostconfig.java:1245)
At Org.apache.catalina.startup.hostconfig$deploydirectory.run (hostconfig.java:1895)
At Java.util.concurrent.executors$runnableadapter.call (Unknown Source)
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.factory.BeanCreationException:Could not autowire method:public void Org.mybatis.spring.mapper.MapperFactoryBean.setSqlSessionFactory (org.apache.ibatis.session.SqlSessionFactory); Nested exception is org.springframework.beans.factory.BeanCreationException:Error creating beans with Name ' Sqlsessionfactory ' defined in ServletContext resource [/web-inf/classes/config/applicationcontext.xml]: Error setting property values; Nested exception is Org.springframework.beans.NotWritablePropertyException:Invalid property ' Typealiasespackage ' of Bean class [Org.mybatis.spring.SqlSessionFactoryBean]: Bean property ' typealiasespackage ' are not writable or have an Invali D Setter method. Does the parameter type of the setter match the return type of the getter?
At org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$ Autowiredmethodelement.inject (autowiredannotationbeanpostprocessor.java:593)
At Org.springframework.beans.factory.annotation.InjectionMetadata.inject (injectionmetadata.java:87)
At Org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues ( autowiredannotationbeanpostprocessor.java:284)
... More
caused by:org.springframework.beans.factory.BeanCreationException:Error creating bean with Name ' sqlsessionfactory ' defined in ServletContext resource [/web-inf/classes/config/applicationcontext.xml]: Error setting property values; Nested exception is Org.springframework.beans.NotWritablePropertyException:Invalid property ' Typealiasespackage ' of Bean class [Org.mybatis.spring.SqlSessionFactoryBean]: Bean property ' typealiasespackage ' are not writable or have an Invali D 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:1396)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean ( abstractautowirecapablebeanfactory.java:1118)
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:294)
At Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:225)
At Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:291)
At Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:193)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates ( defaultlistablebeanfactory.java:848)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency ( defaultlistablebeanfactory.java:790)
At Org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency ( defaultlistablebeanfactory.java:707)
At org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$ Autowiredmethodelement.inject (autowiredannotationbeanpostprocessor.java:551)
... More
caused By:org.springframework.beans.NotWritablePropertyException:Invalid property ' typealiasespackage ' of Bean class [Org.mybatis.spring.SqlSessionFactoryBean]: Bean property ' Typealiasespackage ' are not writable or have an invalid setter me Thod. Does the parameter type of the setter match the return type of the getter?
At Org.springframework.beans.BeanWrapperImpl.setPropertyValue (beanwrapperimpl.java:1064)
At Org.springframework.beans.BeanWrapperImpl.setPropertyValue (beanwrapperimpl.java:924)
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:1393)

Took me for a long time, the result is Mybatis-spring-1.0.0.jar This package version is too low, this package at least with Mybatis-spring-1.1.1.jar, the replacement of a bit can be

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.