Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.78 KB | None | 0 0
  1. public class GeolocationServiceTest extends AbstractAnnotationAwareTransactionalTests {
  2.  
  3. private static final String GEOJSON_FILE = "geojson_demo.geojson";
  4.  
  5. private static final String GEOJSON_FILE2 = "geojson_ecat.geojson";
  6.  
  7. private static final String ADDRESS = "Avenue+de+Beaulieu+25+PARIS";
  8.  
  9. private static final String ADDRESS2 = "Rue Jourdan+1+-+PARIS";
  10.  
  11.  
  12. private static final String[] CONFIG_LOCATIONS = new String[] {
  13. "classpath:com/devices/testServiceContext.xml",
  14. "classpath:com/devices/testApplicationContext.xml", "classpath:com/devices/testDatabaseMessageSource.xml", "classpath:com/devices/propertyeditorsContext.xml" };
  15.  
  16.  
  17. @Autowired
  18. private CompanyDao companyDao;
  19.  
  20. @Autowired
  21. private GeolocationService geolocationService;
  22.  
  23. ...
  24. }
  25.  
  26. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.devices.services.GeolocationServiceTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.devices.services.geolocation.GeolocationService com.devices.services.GeolocationServiceTest.geolocationService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.devices.services.geolocation.GeolocationService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  27. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)
  28. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146)
  29. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:376)
  30. at org.springframework.test.AbstractDependencyInjectionSpringContextTests.injectDependencies(AbstractDependencyInjectionSpringContextTests.java:210)
  31. at org.springframework.test.AbstractDependencyInjectionSpringContextTests.prepareTestInstance(AbstractDependencyInjectionSpringContextTests.java:184)
  32. at org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:103)
  33. at junit.framework.TestCase.runBare(TestCase.java:139)
  34. at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:79)
  35. at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.access$001(AbstractAnnotationAwareTransactionalTests.java:74)
  36. at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.run(AbstractAnnotationAwareTransactionalTests.java:179)
  37. at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTest(AbstractAnnotationAwareTransactionalTests.java:287)
  38. at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTestTimed(AbstractAnnotationAwareTransactionalTests.java:258)
  39. at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runBare(AbstractAnnotationAwareTransactionalTests.java:176)
  40. at junit.framework.TestResult$1.protect(TestResult.java:122)
  41. at junit.framework.TestResult.runProtected(TestResult.java:142)
  42. at junit.framework.TestResult.run(TestResult.java:125)
  43. at junit.framework.TestCase.run(TestCase.java:129)
  44. at junit.framework.TestSuite.runTest(TestSuite.java:255)
  45. at junit.framework.TestSuite.run(TestSuite.java:250)
  46. at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
  47. at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
  48. at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  49. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
  50. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
  51. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
  52. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
  53. Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.devices.services.geolocation.GeolocationService com.devices.services.GeolocationServiceTest.geolocationService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.devices.services.geolocation.GeolocationService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  54. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517)
  55. at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
  56. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)
  57. ... 25 more
  58. Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.devices.services.geolocation.GeolocationService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  59. at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:988)
  60. at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:858)
  61. at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)
  62. at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489)
  63. ... 27 more
  64.  
  65.  
  66. here you can see the file testServiceContext.xml:
  67.  
  68. <!-- Scan for services -->
  69. <context:component-scan base-package="com.devices.services.impl" />
  70. <context:component-scan base-package="com.devices.services.geolocation" />
  71.  
  72. package com.devices.services.geolocation
  73.  
  74. @Service(value = "geolocationService")
  75. public interface GeolocationService {
  76. ....
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement