title: Spring: constructor injection of primitive values (properties) with annotation based configuration
body: <p>I'm trying to configure a class with Annotation based configuration in Spring 3, which takes primitive values as its constructor arguments:</p>
  
  <pre><code>@Component
  class MyBean {
    MyBean(String arg1, String arg2) {
      // ...
    }
  }
  </code></pre>
  
  <p>And an application context like this:</p>
  
  <pre><code>&lt;beans [...]&gt;
    &lt;context:component-scan base-package="com.example" /&gt;
    &lt;context:property-override location="/WEB-INF/example.properties" /&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>I'm trying to find some way to specify that the constructor arguments should be taken from the properties file. Apparently this does work with constructors that take regular beans (e.g. <code>MyClass(Bean bean1, OtherBean bean2)</code>), but just properties?</p>
  
  <p>I have also tried annotating the constructor arguments with Spring 3's <code>@Value</code> annotation and an EL expression for the value, like <code>@Value("#{prop.Prop1}") arg1</code>, but that doesn't seem to work either.</p>