【问题标题】:How to configure Spring Webflow 2.3.1 with @Configuration?如何使用@Configuration 配置 Spring Webflow 2.3.1?
【发布时间】:2012-07-15 20:57:29
【问题描述】:

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

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

    ....

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

</beans>

但是在 spring 3.1 中,可以使用 @Configuration 从 Java 执行所有配置并摆脱 application-context.xml。

我的网络配置如下:

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

    ...

}

是否也可以使用@Configuration 摆脱webflow-config.xml?如果是怎么办?如果没有,如何让我的网络配置包含webflow-config.xml?

【问题讨论】:

    标签: java spring configuration annotations spring-webflow


    【解决方案1】:

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

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

    @ImportResource("/WEB-INF/web/webflow.xml")
    

    【讨论】:

      猜你喜欢
      • 2011-06-17
      • 2018-09-24
      • 2014-07-01
      • 2013-10-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-25
      相关资源
      最近更新 更多