Add protected methods to FlowModelFlowBuilder

This allows a custom build of the Flow ApplicationContext.

See gh-111
This commit is contained in:
Scott Cantor
2022-07-14 12:58:20 -04:00
committed by rstoyanchev
parent ae6efce58d
commit dab4438e91

View File

@@ -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.
*
* <p>Subclasses may override this method to fully control the nature and behavior of the
* Spring context for the flow.</p>
*
* @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));
}