@Bean
public TemplateService templateService(){
if(applicationContext.containsBean("custom_templateService")){
return (TemplateService)applicationContext.getBean("custom_templateService");
}
SpringWebTemplateService templateService = new SpringWebTemplateService();
ViewResolver viewResolver = applicationContext.getBean("viewResolver", ViewResolver.class);
templateService.setViewResolver(viewResolver);
return templateService;
}