Spring Data repository can't autowire
问题 I'm creating a new Spring Boot app from the scratch and want to write tests for it. I've just implemented authentication into my app and want to learn how roles work. When I use my UserRepository in the authentication process, everything works as it should. However, when I want to use UserRepository in tests, it says that the object is null, the same one that's OK when I use it in the app code. Why is that? Here's the code. Security configuration class: @Configuration @EnableWebSecurity