title: Spring JMX. Set the default value of @ManagedAtrribute through XML
body: <p>I'm using Spring 3.0.5</p>
  
  <p>I have a @ManagedResource bean, for some of the @ManagedAttribute methods which I want to set a defaultValue. Instead of setting it to a hardcoded value I want to be able to read it from a property value at load time, since the default changes from environment to environment.</p>
  
  <p>A snippet from my programs applicationContext.xml:</p>
  
  <pre><code>&lt;context:mbean-export default-domain="sampleApp"/&gt;
  &lt;bean id="managedBean" class="com.example.sampleBean"&gt;
      &lt;constructor-arg value="Sample Bean"/&gt;
      &lt;constructor-arg value="${sample.property}"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>I believe I have to use the XML configuration to be able to do this, but haven't figured out how to do it yet.</p>