Exam 2v0-7222 All QuestionsBrowse all questions from this exam
Question 69

Which two statements are true regarding @WebMvcTest? (Choose two.)

    Correct Answer: A, B

    The statements 'It auto-configures a MockMvc' and 'It will only scan for @Controller beans in the source code' are true regarding @WebMvcTest. @WebMvcTest is used for testing Spring MVC controllers, and it does not start a full server but nonetheless provides the necessary configuration to test @Controller classes and similar components. It auto-configures MockMvc, which is a crucial part of testing Spring MVC handlers. It also restricts the component scanning to only @Controller beans, making it efficient for controller layer testing.

Discussion
2211094Options: AD

Sorry CD is not correct but rather AD, why because @WebMvcTest is specifically designed for testing Spring MVC components without starting a full application server

2211094

CD is correct answer.