In Spring Boot, when testing service layer components, the _____ annotation can be used to avoid loading the complete ApplicationContext.

  • @DataJpaTest
  • @MockBean
  • @ServiceTest
  • @SpringBootTest
When testing service layer components in Spring Boot, you can use the @MockBean annotation to mock dependencies and avoid loading the complete ApplicationContext. This helps in isolating the unit under test.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *