June 2018
Intermediate to advanced
408 pages
11h 23m
English
In Spring 5.0, to create a Spring application context and to configure a ViewResolver using Java configuration, we need to add the following code in the class:
@Configuration@EnableWebMvc@ComponentScan({ "com.packt.springhighperformance.ch4.bankingapp.controller"})public class SpringMvcWebConfig implements WebMvcConfigurer { @Bean public InternalResourceViewResolver resolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/WEB-INF/views/"); resolver.setSuffix(".jsp"); return resolver; }}
In the preceding code, we created a class, SpringMvcWebConfig, implementing a WebMvcConfigurer interface, which provides options for ...
Read now
Unlock full access