我们使用Spring MVC +的内置支持上传文件。我想使用SpEL设置最大上传大小。问题是这个值来自我们的数据库。因此,在我们旧的应用程序代码中,我们做了一次检查,我们有以下上传的文件:使用Spel + hibernate创建Bean
appManager.getAppConfiguration().getMaximumAllowedAttachmentSize();
然后我们检查文件,看它是否大于该值,并根据尺寸进行。
我想,在我们的servlet配置以下调用像这样来替换代码:
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver>
<property name="maxUploadSize" value="#{appManager.getAppConfiguration().getMaximumAllowedAttachmentSize()}" />
</bean>
的问题是,在初始化时我收到以下异常:
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
是有什么办法可以做到这一点?