Skip to content
Advertisement

How do you test a reactive mongo repository?

I’m trying to test the findByPhoneNumber method in this repository

JavaScript

ATM, my test looks like this

JavaScript

When I run it, I get this error

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'io.freesale.repository.UserRepositoryTest': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'io.freesale.repository.UserRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

I’m a Spring noob so please don’t bully me too hard 😀

Advertisement

Answer

I was missing the @DataMongoTest annotation

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement