Я пытаюсь настроить Spring Webflow и JSF.К сожалению, я не могу «запустить» поток.Весь код проекта доступен в моем репозитории github: https://github.com/SharpShooter17/SpringBootJsfWebFlowConfiguration
Я пытался отправить все представления и потоки в каталог WEB-INF, но это не сработало.Пожалуйста, помогите мне.
Конфигурация WebFlow:
@Bean
public FlowDefinitionRegistry flowRegistry() {
return getFlowDefinitionRegistryBuilder()
.setBasePath("/")
.addFlowLocationPattern("/**/*-flow.xml")
.setFlowBuilderServices(this.flowBuilderServices())
.addFlowLocation("parent-flow.xml")
.build();
}
@Bean
public FlowExecutor flowExecutor() {
return getFlowExecutorBuilder(flowRegistry())
.addFlowExecutionListener(new FlowFacesContextLifecycleListener())
.addFlowExecutionListener(new SecurityFlowExecutionListener())
.build();
}
@Bean
public FlowBuilderServices flowBuilderServices() {
return getFlowBuilderServicesBuilder()
.setDevelopmentMode(true)
.build();
}
WebMvcConfig
@Autowired
private WebFlowConfiguration webFlowConfig;
@Bean
public ViewResolver urlBasedViewResolver() {
UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver();
urlBasedViewResolver.setViewClass(JsfView.class);
urlBasedViewResolver.setPrefix("/");
urlBasedViewResolver.setSuffix(".xhtml");
return urlBasedViewResolver;
}
@Bean
public FlowHandlerMapping flowHandlerMapping() {
FlowHandlerMapping handlerMapping = new FlowHandlerMapping();
handlerMapping.setFlowRegistry(this.webFlowConfig.flowRegistry());
return handlerMapping;
}
@Bean
public FlowHandlerAdapter flowHandlerAdapter() {
FlowHandlerAdapter handlerAdapter = new JsfFlowHandlerAdapter();
handlerAdapter.setFlowExecutor(this.webFlowConfig.flowExecutor());
handlerAdapter.setSaveOutputToFlashScopeOnRedirect(true);
return handlerAdapter;
}
Конфигурация сервлета Faces:
@Bean
public ServletRegistrationBean<FacesServlet> facesServletServletRegistrationBean() {
ServletRegistrationBean<FacesServlet> servletRegistrationBean = new ServletRegistrationBean(new FacesServlet(), "*.xhtml");
servletRegistrationBean.setLoadOnStartup(1);
servletRegistrationBean.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
return servletRegistrationBean;
}
@Bean
public ServletListenerRegistrationBean<ConfigureListener> jsfConfigureListener() {
return new ServletListenerRegistrationBean(new ConfigureListener());
}
@Override
public void setServletContext(ServletContext servletContext) {
servletContext.setInitParameter("javax.faces.DEFAULT_SUFFIX", ".xhtml");
servletContext.setInitParameter("javax.faces.PROJECT_STAGE", "Development");
servletContext.setInitParameter("facelets.DEVELOPMENT", "true");
servletContext.setInitParameter("javax.faces.FACELETS_REFRESH_PERIOD", "1");
servletContext.setInitParameter("facelets.DEVELOPMENT", "true");
servletContext.setInitParameter("javax.faces.FACELETS_LIBRARIES", "/WEB-INF/springsecurity.taglib.xml");
servletContext.setInitParameter("com.sun.faces.forceLoadConfiguration", Boolean.TRUE.toString());
servletContext.setInitParameter("primefaces.CLIENT_SIDE_VALIDATION", "true");
servletContext.setInitParameter("primefaces.THEME", "ui-lightness");
servletContext.setInitParameter("primefaces.UPLOADER", "utils");
servletContext.setInitParameter("primefaces.MOVE_SCRIPTS_TO_BOTTOM", "true");
}
Файл потока
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow.xsd"
parent="parent-flow">
<var name="controller" class="com.ujazdowski.springbootwebflow.web.controller.HomePageController"/>
<view-state id="home">
<on-entry>
<evaluate expression="controller.helloMessage()"/>
</on-entry>
</view-state>