Я настроил свой проект в этом методе,
Я хотел бы, чтобы поток запускался в начале веб-приложения, а затем в представлении. Я настроил свой проект таким образом, я также попробовал другой подход, но не сработал
@SpringBootApplication
@ImportResource({"classpath:spring/*/*.xml"})
public class FlowDemoApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(FlowDemoApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(FlowDemoApplication.class);
}
}
с этим WebFlowConfig
@Configuration
public class WebFlowConfig extends AbstractFlowConfiguration {
// core Web Flow
@Bean
public FlowDefinitionRegistry flowDefinitionRegistry() {
return getFlowDefinitionRegistryBuilder()
.addFlowLocationPattern("classpath:flow/main.xml")
.build();
}
@Bean
public FlowExecutor flowExecutor() {
return getFlowExecutorBuilder(flowDefinitionRegistry()).build();
}
// MVC integration
@Bean
public FlowHandlerAdapter FlowHandlerAdapter(FlowExecutor flowExecutor) {
FlowHandlerAdapter flowHandlerAdapter = new FlowHandlerAdapter();
flowHandlerAdapter.setFlowExecutor(flowExecutor);
return flowHandlerAdapter;
}
@Bean
public FlowHandlerMapping flowHandlerMapping(FlowDefinitionRegistry flowDefinitionRegistry) {
FlowHandlerMapping flowHandlerMapping = new FlowHandlerMapping();
flowHandlerMapping.setFlowRegistry(flowDefinitionRegistry);
flowHandlerMapping.setOrder(0);
return flowHandlerMapping;
}
// MVC view resolution
@Bean
public FlowBuilderServices flowBuilderServices(MvcViewFactoryCreator mvcViewFactoryCreator) {
return getFlowBuilderServicesBuilder()
.setViewFactoryCreator(mvcViewFactoryCreator)
.build();
}
@Bean
public MvcViewFactoryCreator mvcViewFactoryCreator(List<ViewResolver> viewResolvers) {
MvcViewFactoryCreator factoryCreator = new MvcViewFactoryCreator();
factoryCreator.setViewResolvers(viewResolvers);
factoryCreator.setUseSpringBeanBinding(true);
return factoryCreator;
}
}
но когда я запускаю приложение SpringBoot, поток не запускается.
<on-start>
......
</on-start>