Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package bootstrap; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.context.support.ReloadableResourceBundleMessageSource; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.view.InternalResourceViewResolver; /** * * @author Xcelsia */ @Configuration @EnableWebMvc @ComponentScan({ "controller", "session", "validation" }) @Import({ ResourceConfig.class }) public class BankingGuideConfig extends WebMvcConfigurerAdapter { @Bean public InternalResourceViewResolver configureInternalResourceViewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/WEB-INF/jsp/"); resolver.setSuffix(".jsp"); return resolver; } @Bean public MessageSource messageSource() { ReloadableResourceBundleMessageSource messageSource; messageSource = new ReloadableResourceBundleMessageSource(); messageSource.setBasename("classpath:/messages"); messageSource.setUseCodeAsDefaultMessage(true); return messageSource; } @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("forward:/index"); } }