Close
« Tutorial

Spring 5.0 WebMvcConfigurer default methods MCQ

0/13
0 ✓
0 ✗

1. What is the main change in Spring 5.0 regarding the WebMvcConfigurer interface?

2. Why is WebMvcConfigurerAdapter no longer needed in Spring 5.0 and later?

3. Which annotation is used to enable Spring MVC configuration in a Java class?

@Configuration
// Add annotation here
public class MyWebConfig implements WebMvcConfigurer { ... }

4. What is the purpose of the configureViewResolvers method in WebMvcConfigurer?

5. Which method is used to map a URL directly to a view without a controller?

@Override
public void addViewControllers(ViewControllerRegistry registry) {
    // Which method call maps a URL to a view?
}

6. What does the ViewControllerRegistry help to achieve?

7. In Spring 5.0+, what is the recommended way to customize MVC configuration?

8. What Java version is required to use the default methods in WebMvcConfigurer?

9. Which method is used to register a view resolver that resolves JSP views?

@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
    // Which call configures JSP view resolution?
}

10. What is the role of @Configuration in a class that implements WebMvcConfigurer?

11. Which component is responsible for delegating requests to the appropriate handlers in Spring MVC?

12. What happens if you override a default method in WebMvcConfigurer?

13. Which interface must a configuration class implement to customize Spring MVC using default methods?

@Configuration
@EnableWebMvc
public class MyConfig implements ________ { ... }

14. What is the primary benefit of using default methods in WebMvcConfigurer?

15. Which registry is passed to the addViewControllers method?

Join