简体   繁体   English

Spring Cloud Dataflow 设置系统属性

[英]Spring Cloud Dataflow Set System Properties

I have written a custom spring cloud stream sink application that starts up when I run it as a spring boot project in eclipse.我编写了一个自定义的 spring 云流接收器应用程序,当我在 eclipse 中将它作为 spring 启动项目运行时,它会启动。 When I deploy my application I need to pass in some system proeprties.当我部署我的应用程序时,我需要传入一些系统属性。 See below.见下文。

@ComponentScan
@EnableConfigurationProperties(MyProperties.class)
@SpringBootApplication
public class MyApplication {//extends SpringBootServletInitializer{

    public static final String COMPONENT_NAME = "my-application";


    @Autowired
    private MyProperties properties;

    public static void main(String[] args) {
        System.setProperty("server.env", "DEVT1");
        System.setProperty("some.other.var", "foo");
        SpringApplication.run(MyApplication.class, args);
    }

I am trying to pass these system properties into dataflow using the Deployment Properties screen, picture below.我正在尝试使用部署属性屏幕将这些系统属性传递到数据流中,如下图所示。 I am wondering if I pass one of these if it is working.我想知道我是否通过了其中一个是否有效。 It seems like my application starts up but is looking for the other property.我的应用程序似乎启动了,但正在寻找其他属性。 When I try passing both I get this weird error saying the main class can not be found.当我尝试通过两者时,我收到一个奇怪的错误,说找不到主类。 So when I pass one my application seems to get farther.因此,当我通过一项时,我的申请似乎走得更远。 Am I close to being on the right track?我快走上正轨了吗? Do I need to separate the arguments some way?我需要以某种方式分隔参数吗? I tried with commas but it didn't seem to make a difference.我试过用逗号,但似乎没有什么区别。

Error when passing two arguments -传递两个参数时出错 -

Error: Could not find or load main class LURzZXJ2ZXIuZW52PVBEMDYsLURBbWljYV9RdWV1ZV9NYW5hZ2Vycz1HV0QwNiwtRGNmZ21nci5jbGFzcy5wYXRoPVxhbWljYS5jb20MaWxlcxtudmNvbmZpZwdwcHJlc291cmNlcw==错误:无法找到或加载主类 LURzZXJ2ZXIuZW52PVBEMDYsLURBbWljYV9RdWV1ZV9NYW5hZ2Vycz1HV0QwNiwtRGNmZ21nci5jbGFzcy5wYXRoPVxhbWljYS5jlcx20dcmwlcwlcw2dwlcwlc

在此处输入图片说明

So the picture in my post above is actually correct for setting jvm arguments.所以我上面帖子中的图片对于设置 jvm 参数实际上是正确的。 My error stemmed from one of my jvm arguments being a file path that was not exposed through docker.我的错误源于我的 jvm 参数之一是未通过 docker 公开的文件路径。 Make sure use-spring-application-json is unchecked if you specify your jvm args this way.如果您以这种方式指定 jvm 参数,请确保未选中 use-spring-application-json。 So this is valid for passing jvm arguments...所以这对于传递 jvm 参数是有效的......

through docker /res/ maps to a folder on my c drive.通过 docker /res/ 映射到我的 c 驱动器上的文件夹。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM