[英]How to autowire crud repository in spring-servlet.xml?
We are getting the below error when are we using crud repository in spring mvc 在Spring MVC中使用Crud存储库时出现以下错误
4352 [localhost-startStop-1] ERROR org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'frCpbController': Injection of autowired dependencies failed; 4352 [localhost-startStop-1]错误org.springframework.web.context.ContextLoader-上下文初始化失败org.springframework.beans.factory.BeanCreationException:创建名称为'frCpbController'的bean时出错:自动连接依赖项注入失败; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.act.group.internal.service.FrCpbManager com.act.group.internal.controller.FrCpbController.frCpbManager; 嵌套的异常是org.springframework.beans.factory.BeanCreationException:无法自动连线字段:com.act.group.internal.service.FrCpbManager com.act.group.internal.controller.FrCpbController.frCpbManager; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FrCpbManager': Injection of autowired dependencies failed; 嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名称为'FrCpbManager'的bean时出错:自动连接依赖项的注入失败; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.act.group.internal.dao.FrCpbRepo com.act.group.internal.service.FrCpbManager.itemA; 嵌套的异常是org.springframework.beans.factory.BeanCreationException:无法自动连线字段:com.act.group.internal.dao.FrCpbRepo com.act.group.internal.service.FrCpbManager.itemA; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.act.group.internal.dao.FrCpbRepo] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. 嵌套的异常是org.springframework.beans.factory.NoSuchBeanDefinitionException:没有找到类型为[com.act.group.internal.dao.FrCpbRepo]的合格Bean作为依赖项:至少应有1个有资格作为此依赖项的自动装配候选的bean。 Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java 依赖注释:org.springframework.bean上的org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)上的{@ org.springframework.beans.factory.annotation.Autowired(required = true)}。 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)的org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146)在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(在org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:296)在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)处的AbstractAutowireCapableBeanFactory.java:458) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java :293) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314) at org.apache.catali :293),位于org.springframework.org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194),位于org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)。 org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java :)上的org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)上的context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) 410)在org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)在org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)在org.apache.catalina.core.StandardContext org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)的.listenerStart(StandardContext.java:4853) na.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) 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.act.group.internal.service.FrCpbManager com.act.group.internal.controller.FrCpbController.frCpbManager; na.util.LifecycleBase.start(LifecycleBase.java:145)位于org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1408)位于org.apache.catalina.core.ContainerBase $ StartChild.call( ContainerBase.java:1398)at java.util.concurrent.FutureTask.run(未知源)at java.util.concurrent.ThreadPoolExecutor.runWorker(未知源)at java.util.concurrent.ThreadPoolExecutor $ Worker.run(未知源)在java.lang.Thread.run(未知源)处造成原因:org.springframework.beans.factory.BeanCreationException:无法自动装配字段:com.act.group.internal.service.FrCpbManager com.act.group.internal.controller .FrCpbController.frCpbManager; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FrCpbManager': Injection of autowired dependencies failed; 嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名称为'FrCpbManager'的bean时出错:自动连接依赖项的注入失败; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.act.group.internal.dao.FrCpbRepo com.act.group.internal.service.FrCpbManager.itemA; 嵌套的异常是org.springframework.beans.factory.BeanCreationException:无法自动连线字段:com.act.group.internal.dao.FrCpbRepo com.act.group.internal.service.FrCpbManager.itemA; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.act.group.internal.dao.FrCpbRepo] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. 嵌套的异常是org.springframework.beans.factory.NoSuchBeanDefinitionException:没有找到类型为[com.act.group.internal.dao.FrCpbRepo]的合格Bean作为依赖项:至少应有1个有资格作为此依赖项的自动装配候选的bean。 Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286) ... 22 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FrCpbManager': Injection of autowired dependencies failed; 依赖项注释:在org.springframework的org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor $ AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517)的{@ org.springframework.beans.factory.annotation.Autowired(required = true)}。 org.springframework.beans.factors.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)上的beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)... 22更多原因:org.springframeworkbean。 .factory.BeanCreationException:创建名称为'FrCpbManager'的bean时出错:自动连接依赖项的注入失败; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.act.group.internal.dao.FrCpbRepo com.act.group.internal.service.FrCpbManager.itemA; 嵌套的异常是org.springframework.beans.factory.BeanCreationException:无法自动连线字段:com.act.group.internal.dao.FrCpbRepo com.act.group.internal.service.FrCpbManager.itemA; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.act.group.internal.dao.FrCpbRepo] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. 嵌套的异常是org.springframework.beans.factory.NoSuchBeanDefinitionException:没有找到类型为[com.act.group.internal.dao.FrCpbRepo]的合格Bean作为依赖项:至少应有1个有资格作为此依赖项的自动装配候选的bean。 Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java 依赖注释:org.springframework.bean上的org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)上的{@ org.springframework.beans.factory.annotation.Autowired(required = true)}。 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)的org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146)在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(在org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:296)在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)处的AbstractAutowireCapableBeanFactory.java:458) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java :293) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489) ... 24 more Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.act.group.internal.dao.FrCpbRepo com.act.group.internal.service.FrCpbManager.itemA; :293),位于org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194),位于org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912)。 org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)处的beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855)在org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor $ AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489)... 24更多原因:org.springframework.beans.factory.BeanCreationException:无法自动装配字段:com.act.group.internal.dao.FrCpbRepo com.act.group。 internal.service.FrCpbManager.itemA; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.act.group.internal.dao.FrCpbRepo] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. 嵌套的异常是org.springframework.beans.factory.NoSuchBeanDefinitionException:没有找到类型为[com.act.group.internal.dao.FrCpbRepo]的合格Bean作为依赖项:至少应有1个有资格作为此依赖项的自动装配候选的bean。 Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286) ... 35 more Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.act.group.internal.dao.FrCpbRepo] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. 依赖项注释:在org.springframework的org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor $ AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517)的{@ org.springframework.beans.factory.annotation.Autowired(required = true)}。 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)上的beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)... 35更多原因:org.springframeworkbean。 .factory.NoSuchBeanDefinitionException:找不到依赖项类型为[com.act.group.internal.dao.FrCpbRepo]的合格Bean:期望至少有1个有资格作为此依赖项的自动装配候选的bean。 Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:988) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:858) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489) ... 37 more Apr 06, 2017 12:55:22 PM org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'frCpbController': Injectio 依赖注释:org.springframework.beans上的org.springframework.beans.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:988)上的{@ org.springframework.beans.factory.annotation.Autowired(required = true)}。 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcess。$ org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)处的factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:858) inject(AutowiredAnnotationBeanPostProcessor.java:489)...更多37,Apr 06,2017 12:55:22 PM org.apache.catalina.core.StandardContext listenerStart严重:向上下文org.springframework.web的侦听器实例发送上下文初始化事件的异常.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException:创建名称为'frCpbController'的bean时出错:Injectio n of autowired dependencies failed; n自动连接的依赖项失败; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.act.group.internal.service.FrCpbManager com.act.group.internal.controller.FrCpbController.frCpbManager; 嵌套的异常是org.springframework.beans.factory.BeanCreationException:无法自动连线字段:com.act.group.internal.service.FrCpbManager com.act.group.internal.controller.FrCpbController.frCpbManager; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FrCpbManager': Injection of autowired dependencies failed; 嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名称为'FrCpbManager'的bean时出错:自动连接依赖项的注入失败; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.act.group.internal.dao.FrCpbRepo com.act.group.internal.service.FrCpbManager.itemA; 嵌套的异常是org.springframework.beans.factory.BeanCreationException:无法自动连线字段:com.act.group.internal.dao.FrCpbRepo com.act.group.internal.service.FrCpbManager.itemA; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.act.group.internal.dao.FrCpbRepo] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. 嵌套的异常是org.springframework.beans.factory.NoSuchBeanDefinitionException:没有找到类型为[com.act.group.internal.dao.FrCpbRepo]的合格Bean作为依赖项:至少应有1个有资格作为此依赖项的自动装配候选的bean。 Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java 依赖注释:org.springframework.bean上的org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)上的{@ org.springframework.beans.factory.annotation.Autowired(required = true)}。 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)的org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146)在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(在org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:296)在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)处的AbstractAutowireCapableBeanFactory.java:458) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java :293) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314) at org.apache.catali :293),位于org.springframework.org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194),位于org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)。 org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java :)上的org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)上的context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) 410)在org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)在org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)在org.apache.catalina.core.StandardContext org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)的.listenerStart(StandardContext.java:4853) na.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398) 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.act.group.internal.service.FrCpbManager com.act.group.internal.controller.FrCpbController.frCpbManager; na.util.LifecycleBase.start(LifecycleBase.java:145)位于org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1408)位于org.apache.catalina.core.ContainerBase $ StartChild.call( ContainerBase.java:1398)at java.util.concurrent.FutureTask.run(未知源)at java.util.concurrent.ThreadPoolExecutor.runWorker(未知源)at java.util.concurrent.ThreadPoolExecutor $ Worker.run(未知源)在java.lang.Thread.run(未知源)处造成原因:org.springframework.beans.factory.BeanCreationException:无法自动装配字段:com.act.group.internal.service.FrCpbManager com.act.group.internal.controller .FrCpbController.frCpbManager; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FrCpbManager': Injection of autowired dependencies failed; 嵌套异常是org.springframework.beans.factory.BeanCreationException:创建名称为'FrCpbManager'的bean时出错:自动连接依赖项的注入失败; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.act.group.internal.dao.FrCpbRepo com.act.group.internal.service.FrCpbManager.itemA; 嵌套的异常是org.springframework.beans.factory.BeanCreationException:无法自动连线字段:com.act.group.internal.dao.FrCpbRepo com.act.group.internal.service.FrCpbManager.itemA; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.act.group.internal.dao.FrCpbRepo] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. 嵌套的异常是org.springframework.beans.factory.NoSuchBeanDefinitionException:没有找到类型为[com.act.group.internal.dao.FrCpbRepo]的合格Bean作为依赖项:至少应有1个有资格作为此依赖项的自动装配候选的bean。 Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286) ... 22 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'FrCpbManager': Injection of autowired dependencies failed; 依赖项注释:在org.springframework的org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor $ AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517)的{@ org.springframework.beans.factory.annotation.Autowired(required = true)}。 org.springframework.beans.factors.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)上的beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)... 22更多原因:org.springframeworkbean。 .factory.BeanCreationException:创建名称为'FrCpbManager'的bean时出错:自动连接依赖项的注入失败; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.act.group.internal.dao.FrCpbRepo com.act.group.internal.service.FrCpbManager.itemA; 嵌套的异常是org.springframework.beans.factory.BeanCreationException:无法自动连线字段:com.act.group.internal.dao.FrCpbRepo com.act.group.internal.service.FrCpbManager.itemA; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.act.group.internal.dao.FrCpbRepo] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. 嵌套的异常是org.springframework.beans.factory.NoSuchBeanDefinitionException:没有找到类型为[com.act.group.internal.dao.FrCpbRepo]的合格Bean作为依赖项:至少应有1个有资格作为此依赖项的自动装配候选的bean。 Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java 依赖注释:org.springframework.bean上的org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)上的{@ org.springframework.beans.factory.annotation.Autowired(required = true)}。 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)的org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146)在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(在org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:296)在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)处的AbstractAutowireCapableBeanFactory.java:458) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java :293) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489) ... 24 more Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.act.group.internal.dao.FrCpbRepo com.act.group.internal.service.FrCpbManager.itemA; :293),位于org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194),位于org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912)。 org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)处的beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855)在org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor $ AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489)... 24更多原因:org.springframework.beans.factory.BeanCreationException:无法自动装配字段:com.act.group.internal.dao.FrCpbRepo com.act.group。 internal.service.FrCpbManager.itemA; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.act.group.internal.dao.FrCpbRepo] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. 嵌套的异常是org.springframework.beans.factory.NoSuchBeanDefinitionException:没有找到类型为[com.act.group.internal.dao.FrCpbRepo]的合格Bean作为依赖项:至少应有1个有资格作为此依赖项的自动装配候选的bean。 Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286) ... 35 more Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.act.group.internal.dao.FrCpbRepo] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. 依赖项注释:在org.springframework的org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor $ AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517)的{@ org.springframework.beans.factory.annotation.Autowired(required = true)}。 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)上的beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)... 35更多原因:org.springframeworkbean。 .factory.NoSuchBeanDefinitionException:找不到依赖项类型为[com.act.group.internal.dao.FrCpbRepo]的合格Bean:期望至少有1个有资格作为此依赖项的自动装配候选的bean。 Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:988) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:858) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489) ... 37 more 依赖注释:org.springframework.beans上的org.springframework.beans.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:988)上的{@ org.springframework.beans.factory.annotation.Autowired(required = true)}。 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcess。$ org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)处的factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:858)注入(AutowiredAnnotationBeanPostProcessor.java:489)...还有37
Please help us in solving the above issue. 请帮助我们解决以上问题。
your question is not clear , but if you want to use CrudRepository in spring MVC project : 您的问题尚不清楚,但是如果您想在Spring MVC项目中使用CrudRepository:
1-create the interface : 1-创建接口:
@Repository
public interface UserDao extends CrudRepository<User, Long>{
}
2-scan the repository: 2扫描存储库:
<jpa:repositories base-package="*****" />
<tx:annotation-driven />
3-create the service and service Imp : 3-创建服务和服务Imp:
public interface UserService {
public User findOne(Long id);
...
}
and use the repository in the service with annotation @Resource 并在服务中使用带有注释@Resource的存储库
@Service
public class UserServiceImpl implements UserService {
@Resource
UserDao userRepository;
@Override
public User findOne(Long id) {
User user = userRepository.findOne(id);
return user;
}
4-scan the service : 4扫描服务:
<context:component-scan base-package="*****" />
5-autowired the service and use it in the controller: 5-自动连接服务并在控制器中使用它:
@Controller
@RequestMapping("/")
public class LoginController {
@Autowired
private UserService userService;
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.