title: How to create custom annotation similar to @autowire and @value
body: <p>We use configuration values from an external source in a large spring application. Is there a way to create a custom annotation so we can 'wire' these configurationvalue providers?</p>
  
  <p>We have a service which provides configuration values based on a number of variables like current environment (dev/prod) and current channel (web/mobile).
  Currently this uses static code and does not use spring.
  I searched for a way to register a custom annotation with spring and a factory for that annotation like so:</p>
  
  <pre><code>@MyConfigurationAnnotation(key="my.config.key", fallbackValue= "1")
  private MyConfigValueProvider provider;
  
  ...
  void someMethod(){
      int val = provider.get(currentEnvironment, Integer.class);
  }
  </code></pre>
  
  <p>I'm searching for a way to register some "myConfigAnnotationBeanFactory" to spring which spring calls with the values from the annotation. The factory  then creates a supplier bean for this specific configuration key.</p>
  
  <p>Is something like this possible in spring? With @Autowire and @Value there are already two annotations which do something similar, I just want to register a third kind of wire-mechanism with spring.</p>