Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9028099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:54:18+00:00 2026-06-16T06:54:18+00:00

In order to implement our solution for versioning of request mappings I implemented my

  • 0

In order to implement our solution for versioning of request mappings I implemented my own RequestMappingHandlerMapping as a subclass of it. I overrode registerHandlerMethod() and lookupHandlerMethod(). The key concept is that one request mapping can appear multiple times, but the various implementations are stored in different Java-packages. My new class picks the required version from the correct package based on the first path element of the servlet path, which is the version number. The version is removed before looking for the proper request mapping handler.

This is how I weave it into Spring:

import javax.inject.Inject;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;

@Configuration
public class VersioningWebMvcConfigurationSupport extends WebMvcConfigurationSupport {

  private VersioningRequestMappingHandlerMapping requestMappingHandlerMapping;

  @Override
  @Bean
  public RequestMappingHandlerMapping requestMappingHandlerMapping() {
    requestMappingHandlerMapping.setOrder(0);
    requestMappingHandlerMapping.setInterceptors(getInterceptors());
    return requestMappingHandlerMapping;
  }

  @Inject
  public void setRequestMappingHandlerMapping(VersioningRequestMappingHandlerMapping requestMappingHandlerMapping) {
    this.requestMappingHandlerMapping = requestMappingHandlerMapping;
  }

}

The IMHO important bits of my applicationContext.xml:

  <context:annotation-config />
  <context:mbean-export />
  <context:component-scan base-package="..." />
  <mvc:annotation-driven />

Let me know if you want me to look for some other lines there.

My problem is that my code runs through correctly, duplicates are handled properly. However, the original (?) RequestMappingHandlerMapping still gets initialised. That one fails due to the duplicate request mappings.

How can I avoid this? The way I see it, my web-app would run nicely without the default RequestMappingHandlerMapping.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T06:54:19+00:00Added an answer on June 16, 2026 at 6:54 am

    Not very sure, but the tag <mvc:annotation-driven /> might be registering the RequestMappingHandlerMapping in your webapp.

    Spring MVC documentation mention that RequestMappingHandlerMapping is by default enabled if you using MVC namespace:

    Spring 3.1 introduced a new set of support classes for @RequestMapping
    methods called RequestMappingHandlerMapping and
    RequestMappingHandlerAdapter respectively. They are recommended for
    use and even required to take advantage of new features in Spring MVC
    3.1 and going forward. The new support classes are enabled by default from the MVC namespace and with use of the MVC Java config but must be
    configured explicitly if using neither.

    Source: documentation

    So I suspect you have to get rid of that <mvc:annotation-driven /> tag in order to disable the default behavior of RequestMappingHandlerMapping.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In order to implement different versions of our UI we broke our program up
I was wondering how exactly does TCP implement in-order delivery. lets say this is
I wanted to implement a default sort order in my domain class and immediately
I need to implement a plugin architecture within c#/.net in order to load custom
I'm trying to implement a custom SimpleCursorAdapter in order to switch out layouts in
I'm looking to implement a warning if the user attempts to leave the order
How do i implement a java comparator class which can sort the order of
I've implemented a custom UIButton and in order for me to handle LongPress events
So I just implemented a base controller on my MVC3 site in order to
I have an owner-drawn UserControl where I've implemented double-buffering. In order to get double-buffering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.