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 9176701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:09:59+00:00 2026-06-17T17:09:59+00:00

I want to make the Request Mappings in my Spring application dynamic. So that

  • 0

I want to make the Request Mappings in my Spring application dynamic. So that my url can not be understandable. And I can show anything meaningless to the user and still mapping purpose will be resolved.

For that I am storing the dynamic part of the URL in properties file. And want to use that in the @RequestMapping annotation. And the same thing will be done on the client side in JSP. I will read the value from the property file and then create the href.

I am using @Value annotation to read the property file values.

There is one class that holds all such values in final static variables.

public class UrlMappingAbstraction {
    public static final @Value("#{urlAbstractionProperties['url.message']?:'message'}") String MESSAGE = "";
}

And I am extending this class in my controller and using the static final field in the @RequestMapping annotation like below.

@RequestMapping(value="/"+MESSAGE+"/{id}", method=RequestMethod.GET)

And in jsp also I am reading the value from property file using <spring:message/> and generating the url in href.

The problem is jsp able to create the correct url based on the property file value but in the @RequestMapping annotation my value is not getting replaced.

Can anybody tell me the exact problem? I know that we can not change the value of static final variable after its initialized. Then what’s the use of @Value annotation.

If this can be done another way then you can also show me it.

Thanks in advance.

  • 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-17T17:10:00+00:00Added an answer on June 17, 2026 at 5:10 pm

    Annotations are static by their nature, therefore you cannot do it this way.

    @Value cannot be used on static fields, but it doesn’t matter here – the real problem is that there is no way to use values other than compile time constants as attributes of annotations.

    You can use one of the following alternatives:

    • Add a URL rewrite filter (such as this or this) and configure it to perform the necessary conversion.

      This approach looks more elegant due to clear separation of responsibilities – controllers are responsible for doing their jobs, rewrite filter is responsible for obfuscation of URLs.

    • Intercept creation of controller mappings by overriding RequestMappingHandlerMapping. getMappingForMethod() and change their URL patterns at this step (not tested)

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

Sidebar

Related Questions

I want to make POST request with custom header. I can't find information how
How can I make curl request that will idle after make request ? I
I want to make a POST request to a URL like this: http://localhost/resource?auth_token=1234 And
I am want to make a 'hello world' application whereby I can send some
Hi i want to make a request for soap using above soap xml <soapenv:Envelope
I want to make a get request to the following end point through C#.
So I want to make a http request with a body (say file, file2,
I want to make a HTTP Post request from C#. This request has a
OK when I make a request I want all the items with the same
I'm trying to make a request/reply section in my project. I want to achieve

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.