`

@Autowired 时的异常

阅读更多
14:53:41,390 ERROR TestContextManager:258 - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1465ca2] to prepare test instance [com.wangyu.manager.impl.OrgnizationManagerImplTest@6bba64]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.wangyu.manager.impl.OrgnizationManagerImplTest': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wangyu.manager.impl.OrgnizationManagerImpl com.wangyu.manager.impl.OrgnizationManagerImplTest.orgnizationManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:111)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:148)
	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:59)
	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:52)
	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:50)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wangyu.manager.impl.OrgnizationManagerImpl com.wangyu.manager.impl.OrgnizationManagerImplTest.orgnizationManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435)
	at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:240)
	... 19 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:613)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:412)
	... 21 more




你的OrgnizationManagerImpl必须以@Service或@Component注解才行。


15:51:13,265 ERROR TestContextManager:258 - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@17e60a1] to prepare test instance [com.wangyu.manager.impl.OrgnizationManagerImplTest@1f9f0f2]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.wangyu.manager.impl.OrgnizationManagerImplTest': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wangyu.manager.impl.OrgnizationManagerImpl com.wangyu.manager.impl.OrgnizationManagerImplTest.orgnizationManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:111)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:148)
	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wangyu.manager.impl.OrgnizationManagerImpl com.wangyu.manager.impl.OrgnizationManagerImplTest.orgnizationManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435)
	at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:240)
	... 19 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:613)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:412)
	... 21 more
15:51:13,359 ERROR TestContextManager:258 - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@17e60a1] to prepare test instance [com.wangyu.manager.impl.OrgnizationManagerImplTest@1d4eeb5]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.wangyu.manager.impl.OrgnizationManagerImplTest': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wangyu.manager.impl.OrgnizationManagerImpl com.wangyu.manager.impl.OrgnizationManagerImplTest.orgnizationManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:111)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:148)
	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wangyu.manager.impl.OrgnizationManagerImpl com.wangyu.manager.impl.OrgnizationManagerImplTest.orgnizationManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435)
	at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:240)
	... 19 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:613)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:412)
	... 21 more
15:51:13,375 ERROR TestContextManager:258 - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@17e60a1] to prepare test instance [com.wangyu.manager.impl.OrgnizationManagerImplTest@83e35b]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.wangyu.manager.impl.OrgnizationManagerImplTest': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wangyu.manager.impl.OrgnizationManagerImpl com.wangyu.manager.impl.OrgnizationManagerImplTest.orgnizationManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:111)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:148)
	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wangyu.manager.impl.OrgnizationManagerImpl com.wangyu.manager.impl.OrgnizationManagerImplTest.orgnizationManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435)
	at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:240)
	... 19 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:613)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:412)
	... 21 more
15:51:13,437 ERROR TestContextManager:258 - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@17e60a1] to prepare test instance [com.wangyu.manager.impl.OrgnizationManagerImplTest@c378f6]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.wangyu.manager.impl.OrgnizationManagerImplTest': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wangyu.manager.impl.OrgnizationManagerImpl com.wangyu.manager.impl.OrgnizationManagerImplTest.orgnizationManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:111)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:148)
	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wangyu.manager.impl.OrgnizationManagerImpl com.wangyu.manager.impl.OrgnizationManagerImplTest.orgnizationManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435)
	at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:240)
	... 19 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:613)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:412)
	... 21 more
15:51:13,453 ERROR TestContextManager:258 - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@17e60a1] to prepare test instance [com.wangyu.manager.impl.OrgnizationManagerImplTest@13a83cc]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.wangyu.manager.impl.OrgnizationManagerImplTest': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wangyu.manager.impl.OrgnizationManagerImpl com.wangyu.manager.impl.OrgnizationManagerImplTest.orgnizationManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:111)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:148)
	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wangyu.manager.impl.OrgnizationManagerImpl com.wangyu.manager.impl.OrgnizationManagerImplTest.orgnizationManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435)
	at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:240)
	... 19 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:613)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:412)
	... 21 more
15:51:13,453 ERROR TestContextManager:258 - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@17e60a1] to prepare test instance [com.wangyu.manager.impl.OrgnizationManagerImplTest@a2d304]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.wangyu.manager.impl.OrgnizationManagerImplTest': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wangyu.manager.impl.OrgnizationManagerImpl com.wangyu.manager.impl.OrgnizationManagerImplTest.orgnizationManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:111)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:148)
	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wangyu.manager.impl.OrgnizationManagerImpl com.wangyu.manager.impl.OrgnizationManagerImplTest.orgnizationManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435)
	at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:240)
	... 19 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.wangyu.manager.impl.OrgnizationManagerImpl] is defined: Unsatisfied dependency of type [class com.wangyu.manager.impl.OrgnizationManagerImpl]: expected at least 1 matching bean
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:613)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:412)
	... 21 more
15:51:13,468  INFO GenericApplicationContext:815 - Closing org.springframework.context.support.GenericApplicationContext@1c86be5: display name [org.springframework.context.support.GenericApplicationContext@1c86be5]; startup date [Fri Feb 20 15:51:05 CST 2009]; root of context hierarchy
15:51:13,468  INFO DefaultListableBeanFactory:421 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@165c7f6: defining beans [userBean,annotationPropertyConfigurer,dataSource,sessionFactory,transactionManager,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,allManagerMethod,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,orgnizationManagerImpl,securityManager,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,userDAO,orgnizationDAO,userManager,loggerListener,_authenticationManager,_filterChainProxy,_httpSessionContextIntegrationFilter,_filterChainProxyPostProcessor,_filterChainList,_securityContextHolderAwareRequestFilter,_accessManager,_portMapper,_exceptionTranslationFilter,_filterSecurityInterceptor,_sessionFixationProtectionFilter,_logoutFilter,_basicAuthenticationEntryPoint,_basicAuthenticationFilter,_formLoginFilter,_formLoginEntryPoint,_entryPointInjectionBeanPostProcessor,_userServiceInjectionPostProcessor,org.springframework.security.providers.dao.DaoAuthenticationProvider#0,org.springframework.security.config.AuthenticationProviderBeanDefinitionParser$AuthenticationProviderCacheResolver#0,accessDecisionManager,resourceSecurityInterceptor,secureResourceFilterInvocationDefinitionSource]; root of factory hierarchy
5328 [Thread-5] INFO org.hibernate.impl.SessionFactoryImpl - closing
15:51:13,531  INFO AnnotationSessionFactoryBean:246 - Closing Hibernate SessionFactory


自动写入的时候把接口写成实现类了
@Autowired
private OrgnizationManagerImpl orgnizationManager;
应该是
@Autowired
private IOrgnizationManager orgnizationManager;
分享到:
评论

相关推荐

    Spring注解@Resource和@Autowired.doc

    因此,在选择使用@Resource 或@Autowired 时,需要考虑到具体的使用场景。如果需要按照名称装配,可以使用@Resource,如果需要按照类型装配,可以使用@Autowired。同时,需要注意它们的装配顺序和使用策略,以免出现...

    javaSpring注解入门[参考].pdf

    在上面的例子中,如果当Spring上下文中存在不止一个UserDao类型的bean时,就会抛出BeanCreationException异常;如果Spring上下文中不存在UserDao类型的bean,也会抛出BeanCreationException异常。我们可以使用@...

    spring基础

    使用 @Autowired 注释 ,必须在dtd中声明,否则会出现异常 Spring 2.5 引入了 @Autowired 注释,它可以对类成员变量、方法及构造函数进行标注,完成自动装配的工作。 @Autowired 按照类型来装配 改变如下: ...

    Spring Boot最常用的30个注解.docx

    2 @Autowired 3 @Qualifier 4 @value 5 @ConfigurationProperties 四、 HTTP请求相关 1 @GetMapping 2 @PostMapping 3 @RequestMapping 五、 前后端传值相关 1 @PathVariable 2 @RequestParam 3 @RequestBody 4 @...

    template-spring-boot-gae:Google App Engine 上 Spring Boot 的引导程序模板

    包括什么?...抛出异常时的 JSON 响应 { " code " : 500 , " message " : " Something happen! " , " url " : " http://example.com/documentation_url " } 要更改代码,请使用@ResponseStatus注释

    Spring @Aspect注解

    常见用于记录日志, 异常集中处理, 权限验证以及 Web参数有效验证等等 列子1 (演示基本过程 @Aspect @Component public class TestAspect { /** * 声明一个切入点, 命名 pointcut1 * */ @Pointcut("execution...

    跟着铁哥学Java,MyStore项目 CH02 用户模块实现

    知识点:逻辑主键与物理主键的区别,通用部分的设计,常量的独立存储,postman的使用,参数的校验(@RequestParam,@RequestBody),@NotNull和@NotEmpty的区别,全局异常捕获与处理(使用SpringBoot的切面,前置...

    lagou-transfer:Spring框架大作业

    大作业:自定义@Service、@Autowired、@Transactional注解类,完成基于注解的IOC容器(Bean对象创建及依赖注入维护)和声明式事务控制,写到转账工程中,并且可以实现转账成功和转账异常时事务回滚 编程题: 自定义...

    SSM框架面试题.pdf

    8. @Autowired是如何工作的? 9. 解释Spring MVC流程。 10. Spring框架中的单例Bean是线程安全的吗? 11. 什么是Spring Boot?与Spring有什么区别? 12. 解释Spring中的Java配置方式(@Configuration和@Bean注解)。...

    简化sql过程,自动封装sql,自动识别类与表的关联(作者shyFly)

    本工具针对新手和微小项目,在无大牛帮你封装框架的时候,此工具异常强大。将压缩包解压至本地maven库的com文件夹下,然后项目引入。项目配置下扫描路径com.example,本工具有4个自定义注解,在你的类上声明表明和...

    乐优商城.xmind

    当浏览器发现发现的ajax请求是简单请求时,会在请求头中携带一个字段:Origin 如果服务器允许跨域,需要在返回的响应头中携带下面信息 Access-Control-Allow-Origin:可接受的域,是一个具体域名或者*,代表任意 ...

    安卓打开相机相册功能实现,并通过SpringBoot对接Retrofit2上传图片(@RequestBody转变为MultiPartFile全流程,低门槛实现系列)

    需求分析: ...注:低门槛实现系列就是不涉及过深的知识点,不做过多的异常捕获,不过滤版本不判空,面向小白。 正文 首先需要搭建SSM框架,默认你已经学会了,相应的接口可以看看下面这一篇文章 ...

    Spring的学习笔记

    第一课:面向抽象编程 4 第二课:Jdom的基本使用 4 ...二、 如果不配置事务,openSessionView出现异常 44 三、 中文乱码问题: 44 第十三课:SSH整合的jar包 45 一、 Struts2 45 二、 Hibernate3.3.2 45 三、 Spring 46

    spring2.5 学习笔记

    第一课:面向抽象编程 4 第二课:Jdom的基本使用 4 ...二、 如果不配置事务,openSessionView出现异常 44 三、 中文乱码问题: 44 第十三课:SSH整合的jar包 45 一、 Struts2 45 二、 Hibernate3.3.2 45 三、 Spring 46

    基于SpringBoot编写的RESTFul API,使用HTTP状态码与JSON作为响应规范+源代码+文档说明

    @Autowired private UserTokenComponent userTokenComponent; // 登录 public UserPrincipalVO login(String account, String pwd) { // 登录逻辑验证 ~~~~~ // 验证成功后,可得到用户信息 // 根据用户信息创建...

    spring.doc

    3.6.1 @Autowired 26 3.6.2 @Qualifier 27 3.6.3 @Resource 27 3.6.4 @PostConstruct 28 3.6.5 @PreDestroy 28 注解注入拓展: 28 3.7扫描注入 30 注解扫描拓展: 32 Mvc用注解写: 34 Spring容器IOC和di的整个启动...

    基于springboot实现表单重复提交.docx

    1. 当页面加载时,前端请求后台,后台生成 token 缓存到 Redis 并且反馈给前端。 2. 进入业务办理界面后,业务人员点击某个功能(保存),此时前端携带 token 发送请求到后端的前拦截器(实际业务方法之前的拦截器...

    史上最全java面试,103项重点知识,带目录

    一、Java 基础 1 1. JDK 和 JRE 有什么区别? 1 2. == 和 equals 的区别是什么? 1 3. 两个对象的 hashCode()相同,则 equals()也一定为 true,对吗? 3 4. final 在 java 中有...103. @Autowired 的作用是什么? 62

    java微信公众号MVC开发框架

    提供统一的异常处理机制 提供access_token自动更新机制 请求消息组装 灵活的响应消息类型 二、快速入门 本章教材提供一个最简单的例子,用户在微信公众号发一条foo的文本请求消息,公众号响应一条bar的文本响应消息...

Global site tag (gtag.js) - Google Analytics