title: Bean creation using Spel + hibernate
body: <p>We are using Spring MVC + its built in support for uploading files.  I want to set the maximum upload size utilizing SpEL.  The problem is this value comes from our database.  So in our old application code, we do a check once we have the file uploaded with the following:</p>
  
  <pre><code>appManager.getAppConfiguration().getMaximumAllowedAttachmentSize();
  </code></pre>
  
  <p>We then check the file to see if it is larger than this, and proceed based upon the size.</p>
  
  <p>I'd like to replace that code with the following call in our servlet configuration like such:</p>
  
  <pre><code>&lt;bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver&gt;
      &lt;property name="maxUploadSize" value="#{appManager.getAppConfiguration().getMaximumAllowedAttachmentSize()}" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>The problem is that upon initialization I receive the following exception:  </p>
  
  <pre><code>Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.hibernate.LazyInitializationException: could not initialize proxy - no Session
  </code></pre>
  
  <p>Is there any way to achieve this?</p>