Spring Cloud 数据流自定义应用程序属性 [英] Spring cloud data flow custom application properties
问题描述
我创建了一个自定义的 Spring Cloud 数据流应用程序.我想用它创建一个流并将一些应用程序属性放入其中,因为我们可以为提供的应用程序日志(0/3 属性)添加:
I created a custom spring cloud data flow application. I would like to create a stream with it and put some application properties in it, as we can add for the provided application log (0/3 properties):
我尝试使用 resources 文件夹
中的 application.yml
文件:
I tried with application.yml
file in 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
文件中添加以下声明:
and add the folowing declaration in dataflow-configuration-metadata-whitelist.properties
file:
configuration-properties.classes=com.mycompany.Properties
但这并不成功,而且应用程序没有任何属性.
configuration-properties.classes=com.mycompany.Properties
but that was not a success and the aplication doesn't have any property.
我在文档中找不到任何相关内容(我的母语不是英语,所以我可能误读了一些内容).
I couldn't find anything relevant in documentation (I am not English speaking native so I may have misread something).
感谢您的帮助
在 META-INF 文件夹中移动 dataflow-configuration-metadata-whitelist.properties 后编辑
白名单属性文件不在 META-INF 文件夹下.现在我有了这个项目:
the whitelist property files were not under META-INF folder. Now I have this project:
但它没有帮助.pom.xml 是:
but it doesn't help. The pom.xml is:
<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 构建应用程序.有什么特定的 docker 要做吗?我可以阅读文档,但看不到我的项目中缺少什么
then I build the application with docker. Is there something docker specific to do then? I could read the documentation but cannot see what is missing on my project
推荐答案
多亏了这篇文章,我才能完成这项工作:Spring Cloud Dataflow Kubernetes 从 dockerfile 获取 jar 的属性我注册应用程序的方式是错误的.现在,我添加了伴随的元数据 URI,它可以工作了
I could do the job thanks to this post: Spring Cloud Dataflow Kubernetes get properties of jar from dockerfile The way I registered the app was wrong. Now, I add the companion metadata URI and it works
这篇关于Spring Cloud 数据流自定义应用程序属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!