spring-cloud-dataflow - Spring Cloud 数据流自定义应用属性
问题描述
我创建了一个自定义的 Spring Cloud 数据流应用程序。我想用它创建一个流并将一些应用程序属性放入其中,因为我们可以为提供的应用程序日志(0/3 属性)添加:
我尝试使用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
但这并不成功,并且该应用程序没有任何属性。
我在文档中找不到任何相关的东西(我不是说英语的母语,所以我可能误读了一些东西)。
感谢您的帮助
在 META-INF 文件夹中移动 dataflow-configuration-metadata-whitelist.properties 后编辑
白名单属性文件不在 META-INF 文件夹下。现在我有这个项目:
但这无济于事。pom.xml 是:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-app-starter-metadata-maven-plugin</artifactId>
<executions>
<execution>
<id>aggregate-metadata</id>
<phase>compile</phase>
<goals>
<goal>aggregate-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
然后我用 docker 构建应用程序。那么码头工人有什么具体要做的吗?我可以阅读文档,但看不到我的项目中缺少什么
解决方案
对于自定义应用程序属性,您可以确保您是否正确遵循 Spring Boot 配置属性配置。您可以在此处查看开箱即用应用程序中的一些示例
我不确定您使用哪个版本的 SCDF。如果您使用的是 SCDF 2.x 之前的版本,则白名单属性的名称需要为spring-configuration-metadata-whitelist.properties
具有该名称的白名单属性文件,dataflow-configuration-metadata-whitelist.properties
仅从 SCDF 2.x 开始支持。
此外,请确保将白名单属性文件放入/META-INF
类路径(src/main/resources 目录)下的目录中,例如此处。
关于文档,请按照SCDF 文档中提到的说明进行操作。
推荐阅读
- python - python中的位置参数与数据透视表不匹配
- regex - 正则表达式将一行中的第一个小写字符替换为大写
- jenkins - 白名单方法中的 Jenkins RejectedAccessException
- spring-boot - 带有 java 11 throws 的 Spring Boot 多模块项目无法访问类 org.springframework.cglib.core.ReflectUtils
- ios - 为什么在我的 iOS 应用程序中尝试调用谷歌地图时出现“错误域 = NSURLErrorDomain 代码 = -1004“无法连接到服务器。”错误?
- javascript - 如何将渲染的 pdf(从 html 生成)保存到我的计算机?
- google-sheets - 通过在 Google 表格中添加新行来复制列
- c# - Automapper 可查询扩展映射到类
- postgresql - 如何使用 geoserver/postgrsql 编写 wfs 事务插入
- eclipse - 如何在 Eclipse 氧气中添加外部 jar,以便它们自动可供所有其他项目使用?