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

  • Home
  • SEARCH
  • 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 8662369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:43:20+00:00 2026-06-12T16:43:20+00:00

I involved in project where I found a mix of: @RequestMapping(value = events/…); @RequestMapping(value

  • 0

I involved in project where I found a mix of:

@RequestMapping(value = "events/...");
@RequestMapping(value = "/events/...");

(with and without slash before method level annotation).

I perform search:

site:http://static.springsource.org/spring/docs/3.1.x  slash

and read these links:

  • http://forum.springsource.org/showthread.php?130753-Various-Spring-MVC-RequestMapping-configuration-questions
  • Various Spring MVC RequestMapping configuration questions
  • Handling of pre-slash in @RequestMapping
  • https://www.rfc-editor.org/rfc/rfc6570

But none of these sources answer why skipping slash allowed. Official Spring docs always shown examples with slashes…

Need point to official docs or to Spring sources.

  • 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-12T16:43:22+00:00Added an answer on June 12, 2026 at 4:43 pm

    It does not matter: If the path does not start with an / then Spring (DefaultAnnotationHandlerMapping) will add it.

    See method String[] determineUrlsForHandler(String beanName) of Class DefaultAnnotationHandlerMapping line 122 (Spring 3.1.2) (that is for the class level)

    String[] methodLevelPatterns = determineUrlsForHandlerMethods(handlerType, true);
    for (String typeLevelPattern : typeLevelPatterns) {
        if (!typeLevelPattern.startsWith("/")) {
                typeLevelPattern = "/" + typeLevelPattern;
        }
    

    See method String[] determineUrlsForHandler(Class<?> handlerType, final boolean hasTypeLevelMapping)) of Class DefaultAnnotationHandlerMapping line 182 (Spring 3.1.2) (that is for the method level)

    String[] mappedPatterns = mapping.value();
    if (mappedPatterns.length > 0) {
    for (String mappedPattern : mappedPatterns) {
        if (!hasTypeLevelMapping && !mappedPattern.startsWith("/")) {
            mappedPattern = "/" + mappedPattern;
        }   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm involved in a project where a team of developers is building a very
I'm involved in a project which is able to connect to different hardware devices
I'm involved in a project that, among other things, involves storing edits and changes
I spent the last year working on a project that involved mostly java for
the project that i am involved in has a lot of small modules that
I am involved in a personal project which will require pretty extensive knowledge of
I'm currently involved in a research project that requires me to access a Windows
I have just recently got involved in a classic ASP.NET project which contains lots
I'm working on a small design project, part of which involved writing out text
Soon I will be involved in a project that will be using the agile

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.