- 浏览: 1359962 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (453)
- Struts2 (4)
- Struts1 (16)
- Spring (9)
- Hibernate (5)
- AJAX (16)
- MS Server (9)
- Oracle (35)
- 测试技术 (5)
- 其他 (37)
- JSF (1)
- EJB (5)
- ASP.NET (9)
- iBATIS (5)
- Struts Spring Hibernate (2)
- HTML (12)
- Eclipse使用 (5)
- 设计模式 (5)
- JSP (32)
- 正则表达式 (2)
- 服务器 (12)
- Java基础 (48)
- MySQL (4)
- 面试 (22)
- UML (1)
- 数据结构 (3)
- Ant (2)
- 规范 (4)
- JavaScript (29)
- 软件使用及技巧 (25)
- PHP (1)
- DWR (3)
- FreeMarker (1)
- ExtJs (17)
- JFreeChart (9)
- Reports (2)
- JavaException (1)
- Java Mail (1)
- Flex (9)
- 异常 (12)
- Log4j (2)
- WebService (1)
- jQuery (1)
- Sybase (2)
- myeclipse_plugin (2)
- Linux (5)
- jbpm (2)
- SCM (1)
- mongoDB (1)
最新评论
-
lihua2008love:
<typeAlias alias="User& ...
IBATIS简单操作 -
lihua2008love:
...
关于项目框架设计的一点学习 -
c_jinglin:
我使用<OBJECT CLASSID="cls ...
这就是个静态页面通过js控制mscomm对某com设备进行访问的例子. -
zlbjava:
赞,用了还不错
java获取请求的ip地址,并解析ip所属地区 -
完美天龙:
cs842813290 写道楼主,我明白的地方:在链表已有N个 ...
JAVA实现双向链表
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;
发表评论
-
ids for this class must be manually assigned befor
2009-01-07 12:47 1496ids for this class must be manu ... -
java.lang.NoClassDefFoundError: org/objectweb/asm/
2009-01-07 12:47 1380错误:java.lang.NoClassDefFoundErr ... -
HIBERNATE: No CurrentSessionContext configured!
2009-01-07 12:46 1424没有把hibernate的事务(transaction)绑定到 ... -
使用struts文件上传标签时报 argument type mismatch
2009-01-07 12:45 1897必须在html:form 中加上如下 enctype=&quo ... -
java.lang.NoClassDefFoundError: org/jaxen/JaxenExc
2009-01-07 12:44 1231因为没有把jaxen-1.1-beta-4.jar这个包引入, ... -
关于在tomcat6配置cas问题
2008-12-29 14:46 2740org.apache.jasper.JasperExcepti ... -
java.lang.IllegalArgumentException: object is not
2008-12-26 10:37 1849使用invoke报错,原因为第一个参数不正确. Object ... -
ORA-00257: archiver error. Connect internal only,
2008-12-26 10:35 13661.查询 SQL>select * from V$FL ... -
Oracle Database Vault安装过程中遇到的几个问题及解决
2008-12-26 10:27 19481.安装10.2.0.4补丁后,再安装database vau ... -
weblogic.servlet.jsp.CompilationException:
2008-12-26 10:16 8030weblogic.servlet.jsp.Compilatio ... -
HIbernatre 3.3: org.slf4j.impl.StaticLoggerBinder
2008-12-19 15:41 8554SLF4J: Failed to load class &qu ...
相关推荐
在使用`@Autowired`时,有以下几个关键点需要注意: 1. **类型匹配**:默认情况下,Spring通过类型来查找匹配的Bean。例如,如果一个类有一个类型为`UserService`的属性,并且容器中有至少一个`UserService`类型的...
在阅读《Spring中Autowired和Resource的区别.docx》文档时,可以深入探讨这两个注解的内部实现原理,以及在实际项目中的最佳实践。通过源码分析,我们可以了解到Spring如何解析这些注解并执行依赖注入的过程,这有助...
- **字段注入**:直接在成员变量上使用`@Autowired`,Spring会在初始化时注入对应的bean。 ```java @Autowired private MyService myService; ``` - **方法注入**:可以在setter方法或带有参数的方法上使用`@...
因此,在选择使用@Resource 或@Autowired 时,需要考虑到具体的使用场景。如果需要按照名称装配,可以使用@Resource,如果需要按照类型装配,可以使用@Autowired。同时,需要注意它们的装配顺序和使用策略,以免出现...
当Spring扫描带有`@Autowired`注解的字段、构造函数或方法时,它会执行以下步骤: 1. **候选Bean的查找**:Spring会根据目标类型(如`MovieCatalog`)在`BeanFactory`中搜索Bean。如果提供了`@Qualifier`注解,那么...
当我们在Service层注入Mybatis的Mapper时,我们通常会使用@Autowired 自动注入。但是,这时候Intellij IDEA会显示红色告警,提示不能自动注入。这是因为IDEA可以识别并理解Spring的上下文,但是Mapper接口是Mybatis...
`@Autowired`的`@Retention`设置为`RetentionPolicy.RUNTIME`,意味着该注解会在运行时仍然有效,允许在运行时通过反射等机制访问和处理注解信息。这样,Spring容器在初始化时可以通过反射获取到`@Autowired`注解,...
当遇到`@Autowired`注解时,Spring会通过`AutowiredAnnotationBeanPostProcessor`进行处理,它实现了`BeanPostProcessor`接口,负责在Bean实例化之后进行后处理,包括依赖注入。 ### 8. 实战示例 在`...
当Spring容器初始化时,会扫描所有带有@Autowired的注解,然后通过BeanPostProcessor接口进行后处理,实现依赖注入。 这个过程大致分为以下几步: 1. 找到带有@Autowired的字段、方法或构造器。 2. 根据注解的配置...
但是在多线程处理任务中,当我们使用 @Autowired 注入 bean 时,会出现空指针异常。这是为什么呢? 原因分析: 在 SpringBoot 应用程序中,bean 的注入是通过 ApplicationContext 来实现的。在多线程处理任务中,每...
`@Autowired`注解还支持一些可选属性,例如`required`(默认为true,表示必须注入,否则抛出异常),以及`@Autowired`可以应用于字段、构造器、方法和参数级别,提供了灵活的注入方式。 除了`@Autowired`,Spring...
总结,`@Autowired`的实现涉及到Spring Bean生命周期中的多个阶段,包括BeanPostProcessor的回调、构造函数的选择、依赖匹配和异常处理等。理解这些细节对于优化Spring应用的依赖管理以及排查相关问题至关重要。通过...
当在字段或方法上使用`@Autowired`时,Spring会查找与该字段或方法参数类型相匹配的Bean,并将其注入。如果找到多个匹配的Bean,可以通过提供`@Qualifier`注解来指定特定的Bean。如果没有任何匹配的Bean,Spring会抛...
4. `@Autowired`的可选性:默认情况下,`@Autowired`是非必需的,如果找不到匹配的bean,Spring会抛出异常。你可以通过设置`@Autowired(required=false)`让它成为可选的。 5. Spring配置问题:检查`application....
默认情况下,`@Autowired`是基于类型的,即Spring会查找与目标类型匹配的Bean,如果找到了就注入,如果没有找到则抛出异常。 ### 2. 使用方法 #### 2.1 基于类型的自动装配 在字段、构造函数、方法或参数级别上...
然而,当存在多个相同类型的Bean时,`@Autowired`可能无法准确地确定哪个Bean应该被注入。这时,我们就需要用到`@Qualifier`注解来指定具体的Bean。`@Qualifier`允许你通过Bean的名字来精确地选择需要注入的实例。 ...
例如,如果有多个实现了同一个接口的 Bean,Spring 将无法确定注入哪一个,这时可能会抛出异常。 2. **@Qualifier**:当存在多个候选 Bean 时,可以通过 @Qualifier 注解指定具体要注入哪个 Bean。例如,在上面的...
在上面的例子中,如果当Spring上下文中存在不止一个UserDao类型的bean时,就会抛出BeanCreationException异常;如果Spring上下文中不存在UserDao类型的bean,也会抛出BeanCreationException异常。我们可以使用@...
例如,在`UserManagerImpl`类中,我们可以通过在`userDao`字段上添加`@Autowired`,让Spring在实例化`UserManagerImpl`时自动寻找并注入`UserDao`类型的bean。如果注解在方法上,如`setUserDao`,Spring会在初始化...