【问题标题】:Spring Integration runtime configurationSpring Integration 运行时配置
【发布时间】:2019-10-08 12:59:24
【问题描述】:

是否可以从某个 xml 文件加载 Spring Integration 应用程序上下文和流/集成?例如存储在 DB 中?

Spring Integration 是否将新集成/流的运行时部署解决为 xml,无需重新启动应用程序?

或者 Spring 集成不是这种情况,我应该看看其他的东西,比如 BPMN?

我目前唯一的想法是使用FileSystemXmlApplicationContext 加载新的集成/流。

我要解决的问题是允许在运行时动态添加新的集成/流而无需重新部署。

【问题讨论】:

    标签: spring spring-integration


    【解决方案1】:

    您可以将新流加载到作为主上下文子级的应用程序上下文中。它将对父上下文中的任何 bean 可见(反之亦然)。

    /**
     * Create a new ClassPathXmlApplicationContext with the given parent,
     * loading the definitions from the given XML files and automatically
     * refreshing the context.
     * @param configLocations array of resource locations
     * @param parent the parent context
     * @throws BeansException if context creation failed
     */
    public ClassPathXmlApplicationContext(String[] configLocations, ApplicationContext parent) throws BeansException {
        this(configLocations, true, parent);
    }
    

    【讨论】:

    • 我可以从位于给定 URL 的一些 xml 加载新的上下文定义吗? (例如rest api)
    • 是的,configLocations 可以是任何 Spring 资源(classpath:file:http:)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-07
    • 1970-01-01
    • 1970-01-01
    • 2015-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多