Spring boot test “No qualifying bean of type available”

We Are Going To Discuss About Spring boot test “No qualifying bean of type available”. So lets Start this Java Article.

Spring boot test “No qualifying bean of type available”

  1. Spring boot test “No qualifying bean of type available”

    The test environment needs to know where your beans are defined, so you have to tell it the location.
    In your test class, add the @ContextConfiguration annotation:

  2. Spring boot test “No qualifying bean of type available”

    The test environment needs to know where your beans are defined, so you have to tell it the location.
    In your test class, add the @ContextConfiguration annotation:

Solution 1

The test environment needs to know where your beans are defined, so you have to tell it the location.

In your test class, add the @ContextConfiguration annotation:

@RunWith(SpringRunner.class)
@AutoConfigureTestDatabase(replace = Replace.NONE)
@DataJpaTest
@ContextConfiguration(classes = {YourBeans.class, MoreOfYourBeans.class})
public class UserRepoTest {

  @Autowired
  private UserRepo userRepo = null;

  @Autowired
  private TestEntityManager entityManager = null;

Original Author JimHawkins Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment