Spring Framework
  1. Spring Framework
  2. SPR-8454

Introduce Registration objects in Spring MVC Java-based configuration API

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Complete
    • Affects Version/s: 3.1 M2
    • Fix Version/s: 3.1 RC1
    • Component/s: Web
    • Labels:
      None
    • Last commented by a User:
      false

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

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Rossen Stoyanchev
            Reporter:
            Rossen Stoyanchev
            Last updater:
            Trevor Marshall
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              2 years, 44 weeks ago