@MockBean Not Injecting Dependencies Correctly in Spring Boot Unit Test
I am working on a unit test for a Spring Boot application. I have a MettricsLogger
DI that work fine in the service code, but failed to pass the unit test as it’s null in the test. Despite using @MockBean, the injected dependency (MetricsLogger) is still null and give me NPE. Thank you for any suggestion!