Details
Description
Summary of changes:
- Introduce methods returning Registration objects where multiple registrations are expected (interceptors, view controllers)
- Allow configuration of multiple resource handlers via same Registration object approach
- Change suffix of classes that return Registration objects from *Configurer to *Registry
Before & After:
public void configureInterceptors(InterceptorConfigurer interceptorConfigurer) { interceptorConfigurer.mapInterceptor(new String[] {"/foo"}, new FooInterceptor()); }
public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new FooInterceptor()).addPathPatterns("/foo"); }
Before & After:
public void configureViewControllers(ViewControllerConfigurer configurer) { configurer.mapViewName("/foo", "foo"); }
public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/foo").setViewName("foo"); }
Before & After:
public void configureResourceHandling(ResourceConfigurer configurer) { configurer.addPathMapping("/css/**").addResourceLocation("/css/"); configurer.addPathMapping("/images/**").addResourceLocation("/images/"); }
public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/css/**").addResourceLocations("/css/").setCachePeriod(1); registry.addResourceHandler("/images/**").addResourceLocations("/images/").setCachePeriod(1); }