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.
Loading...
Related Quiz
- How can you customize the response message sent to the client when a validation error occurs?
- In Spring Boot, which annotation is used to conditionally enable caching only when a certain property is set?
- How can application properties be overridden in Spring Boot for different environments?
- Imagine you are developing a Spring Boot application with a read-heavy database workload. How would you optimize the application and database connectivity to handle high read requests efficiently?
- In a Spring Security application, you need to implement a feature where the users' passwords must be rotated every 30 days. How would you approach implementing this feature while maintaining a high level of security?