From dab4438e916eea711045243de7ac228eaea65c3c Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Thu, 14 Jul 2022 12:58:20 -0400 Subject: [PATCH] Add protected methods to FlowModelFlowBuilder This allows a custom build of the Flow ApplicationContext. See gh-111 --- .../builder/model/FlowModelFlowBuilder.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java index 4e2a3981..1d5f4a72 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/model/FlowModelFlowBuilder.java @@ -263,7 +263,7 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { public boolean hasFlowChanged() { return flowModelHolder.hasFlowModelChanged(); } - + public String getFlowResourceString() { return flowModelHolder.getFlowModelResource().getDescription(); } @@ -284,6 +284,10 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { return flowModel; } + protected FlowModelHolder getFlowModelHolder() { + return flowModelHolder; + } + protected LocalFlowBuilderContext getLocalContext() { return localFlowBuilderContext; } @@ -303,11 +307,23 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder { protected void registerFlowBeans(ConfigurableBeanFactory beanFactory) { } + /** + * Build a {@link GenericApplicationContext} for the flow definition being build. + * + *

Subclasses may override this method to fully control the nature and behavior of the + * Spring context for the flow.

+ * + * @return the built and refreshed context + */ + protected GenericApplicationContext createFlowApplicationContext() { + Resource[] contextResources = parseContextResources(getFlowModel().getBeanImports()); + return createFlowApplicationContext(contextResources); + } + // internal helpers private void initLocalFlowContext() { - Resource[] contextResources = parseContextResources(getFlowModel().getBeanImports()); - GenericApplicationContext flowContext = createFlowApplicationContext(contextResources); + GenericApplicationContext flowContext = createFlowApplicationContext(); setLocalContext(new LocalFlowBuilderContext(getContext(), flowContext)); }