[SPR-8454] Introduce Registration objects in Spring MVC Java-based configuration API Created: 15/Jun/11  Updated: 19/Jun/12  Resolved: 15/Jun/11

Status: Closed
Project: Spring Framework
Component/s: Web
Affects Version/s: 3.1 M2
Fix Version/s: 3.1 RC1

Type: Improvement Priority: Minor
Reporter: Rossen Stoyanchev Assignee: Rossen Stoyanchev
Resolution: Complete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Days since last comment: 7 years, 6 weeks, 2 days ago
Last commented by a User: false
Last updater: Trevor Marshall

 Description   

Summary of changes:

  1. Introduce methods returning Registration objects where multiple registrations are expected (interceptors, view controllers)
  2. Allow configuration of multiple resource handlers via same Registration object approach
  3. 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);
}

Generated at Fri Jul 20 02:44:56 UTC 2018 using JIRA 7.9.0#79000-sha1:3ca552e944c2fe83b21589bc06f155b9b428cc2b.