- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们的 Webflow (2.3.1) 应用程序为我们通过浏览器打开的每个新流申请了大量内存。
下面的屏幕截图显示了我们的应用程序的内存使用情况。当应用程序启动时,它需要一个初始的 400 Mb。之后,我们在浏览器中打开 4 个单独的、相同的 Webflow 测试页面,每个页面都声称有大约 90Mb 的额外内存。
每个测试页面都从其自己的简单流程定义开始:
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/webflow"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd" start-state="start">
<view-state id="start" view="test/test1">
</view-state>
<end-state id="end"/>
<bean-import resource="../flow-beans.xml"/>
</flow>
JSP测试页面也很简单,只有一行文字。
当我们当前将 JVM 内存设置为 1.5Gb 时,应用程序最终会在打开大约 15 个不同的流后在服务器上崩溃并出现 OutOfMemoryExceptions。考虑到我们屏幕的低复杂性,1.5 Gb 似乎有点多。
我们想知道 Webflow 似乎为这些简单流/页面要求的内存量是否符合预期,因此我们是否应该为服务器 JVM 分配更多内存。如果没有,我们想知道如何减少这种内存使用。
下面是我们整个 webflow 配置。
我们已经尝试添加一个 flow-execution-repository 标签并尝试使用 max-executions-snapshots 和 max-executions 值,但即使是最保守的设置也不会改变我们看到的内存使用情况。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:webflow="http://www.springframework.org/schema/webflow-config"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/webflow-config
http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<!-- Launches new flow executions and resumes existing executions. -->
<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
</webflow:flow-executor>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:our.properties" />
<property name="placeholderPrefix" value="$xxxx"></property>
</bean>
<tx:annotation-driven transaction-manager="$xxxx{txManager}" />
<!-- Creates the registry of flow definitions for this application -->
<webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices">
<webflow:flow-location-pattern value="classpath:flows/**/*-flow.xml" />
</webflow:flow-registry>
<bean id="viewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator">
<property name="viewResolvers" ref="viewResolver" />
</bean>
<bean id="expressionParser" class="org.springframework.expression.spel.standard.SpelExpressionParser">
<constructor-arg name="configuration">
<bean class="org.springframework.expression.spel.SpelParserConfiguration">
<constructor-arg name="autoGrowCollections" value="true" />
<constructor-arg name="autoGrowNullReferences" value="false" />
</bean>
</constructor-arg>
</bean>
<bean id="webflowExpressionParser" class="org.springframework.webflow.expression.spel.WebFlowSpringELExpressionParser">
<constructor-arg name="expressionParser" ref="expressionParser" />
</bean>
<webflow:flow-builder-services id="flowBuilderServices" view-factory-creator="viewFactoryCreator" validator="validator" expression-parser="webflowExpressionParser"/>
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" />
<bean id="projectVersion" class="our.company.versions.ProjectVersionUtil">
<property name="xxxxVersion" value="$xxxx{xxxx.version}" />
<property name="systemConfigurationDao">
<ref bean="SystemConfigurationDao"/>
</property>
</bean>
</beans>
最佳答案
当 Spring Web Flow 开始一个新的流程时,它基本上会构造一个新的 BeanFactory
来加载 xml 文件并导入任何其他 xml 文件。新构造的 BeanFactory
将 DispatcherServlet
的上下文作为其父级。
现在的问题是 bean 工厂构造了所有 bean 的实例,甚至是那些在导入的 XML 文件中定义的实例。
<bean-import resource="../flow-beans.xml"/>
如果那里有很多 bean,那么每个流实例都会复制这些 bean。通常,您不希望所有 bean 都被复制并存储在用户 session 中。
从 flow-beans.xml
中删除单例 bean 并将它们放在正常的应用程序上下文中,它们仍然可以从流定义中引用。或者您可以简单地将 flow-beans.xml
添加到应用程序启动时加载的文件列表中。
关于memory - Spring webflow 使用大量内存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25741579/
首先,我不知道如何为spring webflow配置restful url请求, 例如,如何在输入地址时调用我的 webflow: http://localhost/app/order/edit/10
我试图在 Spring 返回到我的主要流程,只需单击一个按钮即可从我的任何子流程中返回。 当我使用 它只是转到上一个流程,这也是应用程序中的一个子流程。 有任何想法吗? 最佳答案 您只需要在调用流中的
我正在使用 spring webflow,但我需要在使用转换 ==> 评估表达式访问的方法中访问我的 HttpSession。 (所以在包含我的流程的 xml 文件中) 到目前为止,我还没有找到一种方
(来自 SpringSource forum。) 当HttpSession已过期并且用户重新提交流程中的页面,他/她将被送回流程的开头。我想添加到此行为的只是一条消息,解释它发生的原因。 “你没有事件
我正在使用 spring webflow 1.0。我正在上传一个 csv 文件,对其进行解析并在继续之前显示结果。用户可以选择下载包含未通过验证的记录的 csv 文件。当我单击 JSP 中的链接下载此
获取 Spring Webflow 生成的 FLOW ID 完整列表的最佳方法是什么? 这是我的配置: [更新 1] 我应该澄清一下,我想在 Java 代码中执行此操作,而不是通
我有以下情况。我有一个按以下方式配置的 CommonsMultipartResolver bean。 我在 Spring Web Flow View 状态 jsp 中有一些文件上传字段。 如果文件
给予 ... 在jsp View 中我可以通过以下方式成功获取person ${person} 但是当我放入 requestScope 而不是 viewScope ${person}
我的流程中有一些输入,即 我想在最终状态中重定向到取决于此输入的位置。我正在尝试以下操作: 这是行不通的(webflow 不会用它的值替换 ${someInput} (它将它视为标准字符串。您知道
我有一个使用 Webflow 1.0 和 Spring 2.0 构建的项目。我们想升级到 Spring 3,但这需要 Webflow 2.X。 我已经更新了项目中的所有 Spring 和 Webflo
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
首先,我使用 spring webflow 和一些 spring javascript 来简化 ajax 调用。 截至目前,我让 ajax 调用 webflow 以显示适当的片段。 所以我试图使用 S
我正在研究 spring webflows。我的应用程序中有两个 webflow,一个用于添加人员详细信息,另一个用于修改人员详细信息。两个流程都运行良好。现在我想将参数传递给我的修改流程并访问它,以
希望在使用 grails webflow 时使 URL SEO 友好。它对 grails 使用的约定非常有限制,并且很难绕过它的构建方式。 例如,我在名为 FooController 的 Contro
我有两个 Controller ,每个 Controller 都有一个流程。在我的菜单中,有一个指向流程的链接。如果我在流#1中并单击流#2的链接,Grails将向我展示流#1的 View 。 我发现
Grails菜鸟在这里... 如何获取 Grails webflow 状态中的状态名称?我正在使用 Grails WebFlow 和 jQueryMobile 对移动应用程序进行原型(prototyp
我正在尝试使用Ajax请求过渡到WebFlow的下一个状态。但是它保持相同的状态,并返回GSP作为对该状态的响应,而我期望下一个状态的GSP。 以下是WebFlow代码: def gettingSta
我错过了一些东西...... 我有一个 Grails 网络流程,如下所示:- def childFlow = { start { action {
当我提交表单时,我想发送简单的 boolean 值。我不想在 View 状态下创建特殊模型。 所以我的问题是,我可以在没有模型的情况下传递值吗,因为它是使用 spring webflow 的简单单个值
我在一个应用程序中使用 Webflow 2.3.2,并且用户可以在绑定(bind)模型对象的列表中添加/删除一个步骤(他们只是在修改后返回到当前步骤)。例如我的对象可能看起来像这样: public c
我是一名优秀的程序员,十分优秀!