org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.test.ServiceTest': Unsatisfied dependency expressed through field 'restTemplate': No qualifying bean of type [org.springframework.web.client.RestTemplate] found for dependency [org.springframework.web.client.RestTemplate]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.web.client.RestTemplate] found for dependency [org.springframework.web.client.RestTemplate]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

Stack Overflow | hamras | 3 months ago
  1. 0

    Spring Boot Test not working

    Stack Overflow | 3 months ago | hamras
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.test.ServiceTest': Unsatisfied dependency expressed through field 'restTemplate': No qualifying bean of type [org.springframework.web.client.RestTemplate] found for dependency [org.springframework.web.client.RestTemplate]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.web.client.RestTemplate] found for dependency [org.springframework.web.client.RestTemplate]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  2. 0

    Testing Java service layer with spring-boot 1.4

    Stack Overflow | 4 months ago | eszik.k
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.cma.services.StreetTypeServiceImplTest': Unsatisfied dependency expressed through method 'setStreetTypeRepository' parameter 0: No qualifying bean of type [com.cma.repositories.StreetTypeRepository] found for dependency [com.cma.repositories.StreetTypeRepository]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.cma.repositories.StreetTypeRepository] found for dependency [com.cma.repositories.StreetTypeRepository]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
  3. 0

    Why I can't autowire a controller class into a JUnit test class into this Spring Boot application? No qualifying bean found for dependency

    Stack Overflow | 1 month ago | AndreaNobili
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.betriuvis.controller.test.PlaceSearcherControllerTest': Unsatisfied dependency expressed through field 'placeSearcherController'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean found for dependency [com.betrivius.controller.placeSearcher.PlaceSearcherController]: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Spring - unit tests

    Stack Overflow | 6 years ago | bontade
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.bontade.tests.unit.models.UserDAOTest': Unsatisfied dependency expressed through bean property 'dataSource': Set this property value or disable dependency checking for this bean.
  6. 0

    UnsatisfiedDependencyException with dataSource definition - Spring Forum

    spring.io | 1 year ago
    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.onicomconsulting.core.bdo.enums.EnumerationCheck': Unsatisfied dependency expressed through bean property 'dataSource': There are 2 beans of type [interface javax.sql.DataSource] for autowire by type. There should have been 1 to be able to autowire property 'dataSource' of bean 'com.onicomconsulting.core.bdo.enums.EnumerationCheck'.

  1. serious2monkeys 30 times, last 1 month ago
3 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.springframework.beans.factory.NoSuchBeanDefinitionException

    No qualifying bean of type [org.springframework.web.client.RestTemplate] found for dependency [org.springframework.web.client.RestTemplate]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

    at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound()
  2. Spring Beans
    AbstractAutowireCapableBeanFactory.autowireBeanProperties
    1. org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1406)
    2. org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1057)
    3. org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1019)
    4. org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:566)
    5. org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    6. org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:349)
    7. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
    8. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:385)
    8 frames
  3. Spring TestContext
    DependencyInjectionTestExecutionListener.prepareTestInstance
    1. org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118)
    2. org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
    2 frames
  4. org.springframework.boot
    AutoConfigureReportTestExecutionListener.prepareTestInstance
    1. org.springframework.boot.test.autoconfigure.AutoConfigureReportTestExecutionListener.prepareTestInstance(AutoConfigureReportTestExecutionListener.java:46)
    1 frame
  5. Spring TestContext
    SpringJUnit4ClassRunner$1.runReflectiveCall
    1. org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230)
    2. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228)
    3. org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287)
    3 frames
  6. JUnit
    ReflectiveCallable.run
    1. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    1 frame
  7. Spring TestContext
    SpringJUnit4ClassRunner.runChild
    1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289)
    2. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247)
    3. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
    3 frames
  8. JUnit
    ParentRunner$2.evaluate
    1. org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    2. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    3. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    4. org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    5. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    5 frames
  9. Spring TestContext
    RunAfterTestClassCallbacks.evaluate
    1. org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    2. org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    2 frames
  10. JUnit
    ParentRunner.run
    1. org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    1 frame
  11. Spring TestContext
    SpringJUnit4ClassRunner.run
    1. org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
    1 frame
  12. JUnit4 Runner
    JUnit4TestReference.run
    1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    1 frame
  13. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
    5 frames