Spring Cloud数据流定制应用程序属性

问题描述 投票:0回答:1

我创建了一个定制的Spring Cloud数据流应用程序。我想用它创建一个流,并在其中添加一些应用程序属性,因为我们可以为提供的应用程序日志添加属性(0/3属性):enter image description here

我尝试使用application.yml中的resources folder文件:

spring:
  application:
    toto: 'titi'

但是没有用。

我也尝试创建一些Properties.class

public class Properties {

    //public static final String PREFIX = "portin";
    private String toto;

    public Properties(String toto) {
        this.toto = toto;
    }

    public Properties() {
    }

    public String getToto() {
        return toto;
    }

    public void setToto(String toto) {
        this.toto = toto;
    }
}

并在dataflow-configuration-metadata-whitelist.properties文件中添加以下声明:

configuration-properties.classes=com.mycompany.Properties但这并没有成功,应用程序没有任何属性。

我在文档中找不到任何相关内容(我不是英语为母语的人,所以我可能读错了东西。

感谢您的帮助

spring-cloud-dataflow spring-cloud-dataflow-ui
1个回答
0
投票

对于自定义应用程序属性,您可以确保是否正确遵循Spring Boot配置属性配置。您可以从开箱即用的应用程序here

中看到一些示例

我不确定您使用哪个版本的SCDF。如果您使用的是SCDF 2.x之前的版本,则白名单属性的名称需要为spring-configuration-metadata-whitelist.properties,因为SCDF 2.x仅支持名称为dataflow-configuration-metadata-whitelist.properties的白名单属性文件。

此外,请确保将白名单属性文件放入类路径下的/META-INF目录(src / main / resources目录),例如here

关于文档,请遵循SCDF文档中here提及的说明。

© www.soinside.com 2019 - 2024. All rights reserved.