Comecei um projeto que utiliza métodos para configurar a aplicação web e não tenho esse arquivo spring-context.xml, o projeto é Maven e utilizo a classe abaixo para fazer essas configurações, seria nessa classe que deveria configurar esse interceptador? como faço isso?
package br.com.agendapsf.conf;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.format.datetime.DateFormatterRegistrar;
import org.springframework.format.support.DefaultFormattingConversionService;
import org.springframework.format.support.FormattingConversionService;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import br.com.agendapsf.controllers.UsuarioController;
import br.com.agendapsf.daos.UsuarioDAO;
@EnableWebMvc
@ComponentScan(basePackageClasses={UsuarioController.class, UsuarioDAO.class})
public class AppWebConfiguration extends WebMvcConfigurerAdapter{
@Bean
public InternalResourceViewResolver internalResourceViewResolver(){
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".jsp");
return resolver;
}
@Bean
public FormattingConversionService mvcConversionService(){
DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService();
DateFormatterRegistrar formatterRegistrar = new DateFormatterRegistrar();
formatterRegistrar.setFormatter(new DateFormatter("dd/MM/yyyy"));
formatterRegistrar.registerFormatters(conversionService);
return conversionService;
}
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
}