New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Registration objects in Spring MVC Java-based configuration API [SPR-8454] #13100

Closed
spring-issuemaster opened this Issue Jun 15, 2011 · 0 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

spring-issuemaster commented Jun 15, 2011

Rossen Stoyanchev opened SPR-8454 and commented

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);
}

Affects: 3.1 M2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment