如何使用@Configuration配置Spring Webflow 2.3.1?

Jér*_*nge 2 java configuration spring annotations spring-webflow

通常,Spring webflow配置从application-context.xml以下位置导入:

<?xml version="1.0" encoding="UTF-8"?>
<beans .../>

    ....

    <import resource="config/webflow-config.xml" />

</beans>
Run Code Online (Sandbox Code Playgroud)

但是在3.1版本中,可以从Java执行所有配置@Configuration并摆脱它application-context.xml.

我的网络配置有以下内容:

@Configuration
@Import({ MyConfig1.class, MyConfig2.class })
public class WebConfig extends WebMvcConfigurerAdapter {

    ...

}
Run Code Online (Sandbox Code Playgroud)

是否有可能摆脱webflow-config.xml使用@Configuration?如果有,怎么样?如果不是,如何让我的网络配置包括在内webflow-config.xml

Bij*_*men 5

最新的Spring Webflow不支持定义流@Configuration,您必须将流定义为XML并将其导入@Configuration文件.

您可以使用@ImportResource将webflow.xml文件导入@Configuration文件:

@ImportResource("/WEB-INF/web/webflow.xml")
Run Code Online (Sandbox Code Playgroud)