My autowired private RestaurantRepositoryService restaurantRepositoryService is null

When I ran the application in the debug mode to get an idea about how to find the restaurants from the MongoDB,
I noticed that my @autowired private RestaurantRepositoryService restaurantRepositoryService is null and I checked how to resolve it on Google and It said it might be due to one of the two things and I tried both but couldn’t find the error.
Now when I tried to use the RestaurantRepositoryServiceDummyImpl.java file as @service as it has no dependency so even if I was missing any of the two reasons it’ll work but it still remains null.
It the last module the @autowired injected bean was initialized.
I tried but still couldn’t find the reason why my @autowired objects were not initialized.

@theIceman
you haven’t implemented class restaurantRepositoryService and further the restaurantrepositoryservice class autowires the restaurantrepository class which is missing in your code since restaurantrepository extends the mongorepository.

So basically its a chain of dependencies and as mentioned the void in the above statement, we can say that the chain is breaking, please take care of the above mentioned point, complete the chain and the class file, your doubt will get resolved.

and also I think you have missed TODOs in restaurantServicetest.java

if this answer doesn’t solve your issue, please post a screenshot of where are you stuck of getting null, because if you have implemented the class it shouldn’t be null.

I completed the missed TODO in restaurantServicetest.java.
I used the dummy implementation as @service to the RestaurantRepositoryService but it was still null which it shouldn’t be because the dummy implementation isn’t dependent on Mongo right?
I’m still not getting if we need to implement the RestaurantRepository.java.

@theIceman
I am not getting what null vaues you are getting and how it is affecting your code?
Can you share the SS of the same which shows your error and your query?

Closing this topic as your issue has been resolved by the community. If not Kindly un-mark the accepted solution to re-open the topic or feel free to create a new topic and post a link to this topic as a reference.