org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘user’ defined in file [F:\workplace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\StudentManageSSM\WEB-INF\classes\com\z\entity\User.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘java.lang.Long’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory1.getObject(AbstractBeanFactory.java:306)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)atorg.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4900)atorg.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5363)atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)atorg.apache.catalina.core.ContainerBase1.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:867) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) 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:4900) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5363) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase1.getObject(AbstractBeanFactory.java:306)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)atorg.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)atorg.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)atorg.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)atorg.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4900)atorg.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5363)atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)atorg.apache.catalina.core.ContainerBaseStartChild.call(ContainerBase.java:1410)
at org.apache.catalina.core.ContainerBaseStartChild.call(ContainerBase.java:1400)atjava.util.concurrent.FutureTask.run(FutureTask.java:266)atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)atjava.util.concurrent.ThreadPoolExecutorStartChild.call(ContainerBase.java:1400) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutorStartChild.call(ContainerBase.java:1400)atjava.util.concurrent.FutureTask.run(FutureTask.java:266)atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)atjava.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘java.lang.Long’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1493)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1104)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
… 24 more
一开始是去service层查找有没有加@Service,发现service接口和实现类都加了,没毛病,接着又去dao层,dao层加了@Repository,mapper配置路径也没有问题,找了老久了,结果实体类重写了一遍,迷之尴尬的好了。发现空参构造没写,只写了实参构造,导致无参构造被覆盖,给你们个小建议,实体类要写就写全了,不差那么点时间,以免报错找半天
详细解决方案
Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springfram
热度:74 发布时间:2023-11-23 10:35:05.0
相关解决方案
- Exception in thread "main" org.hibernate.HibernateException: /hibernate.cfg.xml解决办法
- 大神们开始觅错啦!org.hibernate.exception.SQLGrammarException: could not execute query
- struts2 exception,该怎么解决
- GWT 报错,能的请进: com.google.gwt.event.shared.UmbrellaException: Exception caught: Se
- java.sql.SQLException: Parameter #一 has not been set
- Exception loading sessions from persistent storage,该怎么解决
- Parameter index out of range (五 > number of parameters, which is 4)
- 呀javax.servlet.ServletException: Servlet execution threw an exception
- Exception in thread "main" java.lang.UnsupportedClassVersionError:有关问题
- null id in com.bsw.gms.hibernate.pojo.Score entry (don't flush the Session after an exception occurs,该怎么解决
- mysql Statement parameter 一 not set
- Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPe解决方法
- 紧急 Exception starting filter struts2
- Enumeration<String> 和 Parameter,该如何处理
- org.hibernate.exception.SQLGrammarException: could not execute query有关问题求解
- SEVERE: Exception starting filter struts2,该怎么处理
- Cause: java.sql.SQLException: 关闭的连接]; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException解决思路
- struts2开发时出现的异常 Exception sending context initialized event to listener instance
- Uncaught exception java/lang/NullPointerException.错误原因
- Exception in thread "main" java.lang.NullPointerException,该怎么处理
- org.apache.commons.lang.exception.NestableRuntimeException
- 错误如下:严重: Exception starting filter struts2Filter
- Uncaught exception java/lang/NullPointerException.解决方法
- 急问:S60,eclipse,打开模拟器总是提示“unhandled exception.Close application?该如何解决
- 运作提示:Exception in threa "main" java.lang.NoSuchMethodError:main
- 严重: Exception starting filter struts2
- Exception in thread "main" java.lang.UnsatisfiedLinkError: com.
- Exception in thread "main" java.lang.InstantiationError:
- Exception in thread "Thread-7" java.lang.UnsatisfiedLinkError:
- EJB调度失败Error: Exception preparing module