title: Changing Annotation value via Reflection does not work JDK17
body: <p>I have spring boot application with some controllers.</p>
  <p>All the controllers have @RequestMapping annotation with a path/value attribute. I would like to change the value of this attribute at runtime by hooking into the bean lifecycle.</p>
  <p>I am using BeanPostProcessor.postProcessBeforeInitialization() to accomplish this and below is the reflection code that I use:</p>
  <pre><code>public class RequestMappingProcessor implements BeanPostProcessor
  {
      @Override
      public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
      {
          RequestMapping requestMapping = bean.getClass().getAnnotation(RequestMapping.class);
  
          System.out.println(&quot;OldAnnotation Value &quot; + requestMapping.value()[0]);
  
          Map&lt;String, Object&gt; attributes = AnnotationUtils.getAnnotationAttributes(requestMapping);
          String[] values = (String[]) attributes.get(&quot;path&quot;);
          var newValue = getNewPath(path);
  
          Object handler = Proxy.getInvocationHandler(annotation);
          Field f;
          try
          {
              f = handler.getClass().getDeclaredField(&quot;memberValues&quot;);
          }
          catch (NoSuchFieldException | SecurityException e)
          {
              throw new IllegalStateException(e);
          }
          f.setAccessible(true);
          Map&lt;String, Object&gt; memberValues;
          try
          {
              memberValues = (Map&lt;String, Object&gt;) f.get(handler);
          }
          catch (IllegalArgumentException | IllegalAccessException e)
          {
              throw new IllegalStateException(e);
          }
          Object oldValue = memberValues.get(key);
          if (oldValue == null)
          {
              throw new IllegalArgumentException();
          }
          memberValues.put(key, newValue);
          memberValues.put(&quot;path&quot;, newValue);
          
          System.out.println(&quot;New Annotation Value &quot; + requestMapping.value()[0]);
  }
  </code></pre>
  <p>The things is that I do see it printing the updated values on console, but when I check the actual endpoint in postman or browser, still the old path works and not the new one.
  JDK 17.</p>
  <p>I know that many would suggest to set the prefixed path at API level for all the controllers and all, but in my case, each controller might have a different prefix based upon some annotation. If you have some other suggestions, please suggest.</p>