Rev 31202 | Rev 32252 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.web.config;import com.fasterxml.jackson.databind.ObjectMapper;import com.spice.profitmandi.web.interceptor.AuthenticationInterceptor;import com.spice.profitmandi.web.interceptor.RoleInterceptor;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.context.annotation.ComponentScan;import org.springframework.context.annotation.Configuration;import org.springframework.format.FormatterRegistry;import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;import org.springframework.http.MediaType;import org.springframework.http.converter.HttpMessageConverter;import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;import org.springframework.web.servlet.config.annotation.*;import java.util.List;@EnableWebMvc@Configuration@ComponentScan({ "com.spice.profitmandi.*" })public class WebConfig extends WebMvcConfigurerAdapter {private static final String RESOURCES_PATTERN = "/resources/**";private static final String RESOURCES_LOCATION = "/resources/";@AutowiredAuthenticationInterceptor authenticationInterceptor;@AutowiredRoleInterceptor roleInterceptor;@AutowiredObjectMapper objectMapper;@Overridepublic void addResourceHandlers(ResourceHandlerRegistry registry) {registry.addResourceHandler(RESOURCES_PATTERN).addResourceLocations(RESOURCES_LOCATION);}@Overridepublic void addInterceptors(InterceptorRegistry registry) {// registry.addInterceptor()registry.addInterceptor(authenticationInterceptor).addPathPatterns("/**").excludePathPatterns("/hdfctest/**","/hdfc/**", "/spicemoney/callback", "/login", "/login/", "/forgetPassword", "/forgetPassword/", "/","/checkplans", "/12dashboard34", "/mandii", "/imei/validate", "/fundfina/**", "/virtualaccount/push-credits");registry.addInterceptor(roleInterceptor).excludePathPatterns("/hdfctest/**", "/hdfc/**", "/spicemoney/callback","/login", "/login/", "/register", "/register/", "/forgetPassword", "/forgetPassword/", "/", "","/12dashboard34", "/mandii", "/imei/validate", "/fundfina/**", "/virtualaccount/push-credits");}@Overridepublic void addFormatters(FormatterRegistry registry) {DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar();registrar.setUseIsoFormat(true);registrar.registerFormatters(registry);}@Overridepublic void extendMessageConverters(List<HttpMessageConverter<?>> converters) {converters.add(new MappingJackson2HttpMessageConverter(objectMapper));}@Overridepublic void configureContentNegotiation(ContentNegotiationConfigurer configurer) {configurer.defaultContentType(MediaType.APPLICATION_JSON_UTF8);}}