Spring MVC configuration

As shown in the following code, here we will be creating Spring MVC specific Java configurations (SpringMVCConfig.java):

@Configuration
@EnableWebMvc
@ComponentScan( basePackages = "com.packtpub")
public class SpringMVCConfig implements WebMvcConfigurer {
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
registry.jsp().prefix("/WEB-INF/views/").suffix(".jsp");
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login");
}
}

In this configuration, set the view's prefix and suffix. Make sure that your login view controller is added explicitly, as we don't have a route defined in our controller (we will see the controller later).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.89.82