Create a starter for SWF to be able to easily integrate SWF configs into Boot apps. Not sure what it would look like, but creating an issue so it could be considered.
Comment From: dsyer
Thanks for the idea. Someone could try it and see. If it ends up just being starter-web + webflow there isn't much value. Webflow isn't really all that fashionable these days so I'm not sure we want to have a starter devoted to it, but we can debate that here if you like.
Comment From: dima767
No debate necessary, but for example SFW is at the core of CAS server (which is our "bread and butter" software) which enables us to make all the different customizations to the login flows, etc.
https://github.com/Jasig/cas
And I was just thinking of writing a next generation of CAS server with Boot, but still utilize SWF. That's where the idea for this issue came in :-)
Best, Dmitriy.
Comment From: philwebb
I think on balance there isn't the audience for a dedicated Web Flow starter so I'm closing this one for now.
Thanks for the suggestion, if we get a lot of comments on this issue we can reconsider.
Comment From: ghiottolino
I am also planning to make a Boot application using Web Flow, therefore I also think a webflow-starter would be nice. Alternatively/additionally, it would be nice to have some posts/tutorials/example where both Boot and Web Flow are present
Comment From: dima767
Too bad GH Issues doesn't have a vote button :-)
But other than that - love the GH Issues. Smart move. Would be terrific if Spring XD folks came to their senses and also moved to GitHub Issues ;-)
Comment From: dsyer
@dima767 In the CAS case wouldn't you have to build a "template" server that the user customizes anyway? So you can probably add the SWF dependencies to that - the user will have to include it as a dependency anyway so they might as well just do that and not have to bother including SWF explicitly as well.
@ghiottolino if anyone wants to propose a Getting Started guide for SWF they can do it by creating a github project and tweeting the URL to @springcentral.
Comment From: dima767
Dave, currently CAS publishes a "template" war to Maven central repo with all its core modules as well as SWF central authentication flow config. Then the pattern for customization is that folks create their local CAS maven project which depend on that centrally published CAS war and employ a mechanism called Maven war overlay to introduce SWF and any other customizations to build the final, customized war that they deployed.
The idea of using Boot for the next gen CAS server sounds too exciting and I was just exploring the possible ways to do this with Spring Boot, make it flexible and customizable and at the same time retain the use of SWF. So this issue was the "avenue" to brainstorm on the possible ways to do that :-)
Comment From: dsyer
I think you can just publish a JAR with transitive dependencies to SWF and users can depend on it - it's a lot simpler to operate (and safer) than a war overlay. If you try it and something is awkward we can definitely try and help out at that point.
Comment From: dima767
Old thread. I know, I know. But just for the record. Here's what currently requires at minimum for config to get the Boot going with SWF and Thymeleaf:
@Configuration
public class WebFlowConfig extends AbstractFlowConfiguration {
@Autowired
private WebMvcConfig webMvcConfig;
@Autowired
private List<ViewResolver> viewResolvers;
@Bean
public FlowExecutor flowExecutor() {
return getFlowExecutorBuilder(flowRegistry())
.addFlowExecutionListener(new SecurityFlowExecutionListener(), "*")
.build();
}
@Bean
public FlowDefinitionRegistry flowRegistry() {
return getFlowDefinitionRegistryBuilder(flowBuilderServices())
.setBasePath("classpath*:/templates")
.addFlowLocationPattern("/**/*-flow.xml")
.build();
}
@Bean
public FlowBuilderServices flowBuilderServices() {
return getFlowBuilderServicesBuilder()
.setViewFactoryCreator(mvcViewFactoryCreator())
.build();
}
@Bean
public MvcViewFactoryCreator mvcViewFactoryCreator() {
viewResolvers.add(this.webMvcConfig.ajaxThymeleafViewResolver());
MvcViewFactoryCreator factoryCreator = new MvcViewFactoryCreator();
factoryCreator.setViewResolvers(viewResolvers);
factoryCreator.setUseSpringBeanBinding(true);
return factoryCreator;
}
}
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Autowired
private WebFlowConfig webFlowConfig;
@Autowired
private SpringTemplateEngine springTemplateEngine;
@Bean
public FlowHandlerMapping flowHandlerMapping() {
FlowHandlerMapping handlerMapping = new FlowHandlerMapping();
handlerMapping.setOrder(-1);
handlerMapping.setFlowRegistry(this.webFlowConfig.flowRegistry());
return handlerMapping;
}
@Bean
public FlowHandlerAdapter flowHandlerAdapter() {
FlowHandlerAdapter handlerAdapter = new FlowHandlerAdapter();
handlerAdapter.setFlowExecutor(this.webFlowConfig.flowExecutor());
handlerAdapter.setSaveOutputToFlashScopeOnRedirect(true);
return handlerAdapter;
}
@Bean
public AjaxThymeleafViewResolver ajaxThymeleafViewResolver() {
AjaxThymeleafViewResolver viewResolver = new AjaxThymeleafViewResolver();
viewResolver.setViewClass(FlowAjaxThymeleafView.class);
viewResolver.setTemplateEngine(springTemplateEngine);
return viewResolver;
}
}
As one could imagine this boilerplate will be needed in every Boot/SWF/Thymeleaf project. So perhaps a starter which will contribute an autoconfigure for this minimum set of beans or may be an explicit @EnableSpringWebFlow.
Just a food for thought.
Cheers, D.
Comment From: chrylis
+1 for adding the starter. Web Flow may be out of fashion, but it looks like it's exactly the tool I need for handling some workflow wizards, and Spring Session just made the keep-partial-transactions-in-session-state model workable again. The configuration above, cleaned up a tad a Bootified, would be very helpful as a starter config. I'd be up for building a starter if there was a likelihood it'd be added.
Comment From: dima767
@chrylis Go for it. What's the worst that could happen? If it doesn't get included in Boot's core, this could always be packaged and released as a sep. dependency, etc.
Comment From: philwebb
/cc @rstoyanchev who might be interested in the Spring Session comment.
Comment From: chrylis
@dima767 There's a lot of subtlety regarding view and resource resolvers that I don't understand. (For example, using relative view paths Just Doesn't Work, and while I've read the code and see why it doesn't work, I don't understand why the code if written that way.) I have a configuration that works-for-me, but something suitable for general consumption would need specific review.
Comment From: eruiz
Just fyi,
Spring Roo 2.0.0.M3 generates Spring Boot applications and integrates Spring Web Flow easier than ever.
The reference guide includes detailed descriptions of all the features.
Comment From: liudonghua123
Glad to see this feature.
Comment From: eroispaziali
Would really love if this could be reconsidered. Web Flow is a very good solution to a problem that is still relevant today, it would be great to have an official starter for it.
Comment From: usharik
Please reopen it if possible.
Comment From: JPCui
now?
Comment From: philwebb
Although Spring Web Flow still serves a purpose and is being maintained, we don't feel like it's a good candidate to have support out of the box in Spring Boot. We're mainly seeing developers opt for richer Javascript frameworks when they need flow style applications, and we'd rather encourage that direction.
Sorry to everyone that's tracking the issue, but we have no plans to add Spring Web Flow support.
Comment From: frozar
@philwebb Hi, I have a simple question : Is Spring Web Flow becoming a deprecated solution/framework?
Comment From: philwebb
@frozar The project has not been deprecated, but these days we are seeing more javascript frameworks being used to provide web flow type functionality in green field projects. We’ll continue to maintain Spring Web Flow, but we won’t be adding any new features to it.
Comment From: wimdetroyer
@philwebb
This discussion was very interesting for me, not as much for having the starter or not, but more the rationale behind not adding it, mentioning that more and more developers opt for modern and rich JS frameworks to implement applications with flow style requirements.
However, I have some remarks, if we look at the spring WebFlow documentation: (see: https://spring.io/projects/spring-webflow)
Then we read:
Spring WebFlow proposes to solve the following common issues observed in stateful web applications with navigation requirements:
- Visualizing the flow is very difficult.
- The application has a lot of code accessing the HTTP session.
- Enforcing controlled navigation is important but not possible.
- Proper browser back button support seems unattainable.
- Browser and server get out of sync with "Back" button use.
- Multiple browser tabs causes concurrency issues with HTTP session data.
- Spring Web Flow provides a solution to the above issues.
I have been trying to find a good javascript framework alternative which solves these problems as 'elegantly' as Spring WebFlow, but for now have not found much.
The closest I can think of is using the React framework together with the redux state container.
However, redux is just that - a state container - and a contract on how to interact with said container.
I don't believe it'd solve the issues listed above out-of-the-box, unless the developer explicitly programs that functionality.
My question:
Is something like a frontend framework (be it react, vue, angular,...) + a state container what you referred to when you mentioned:
[...] javascript frameworks being used to provide web flow type functionality in green field projects.
Or am I missing something very obvious: a JS framework which does much the same as what SpringWebflow solved?