简体   繁体   中英

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. 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==

在此处输入图片说明

So the picture in my post above is actually correct for setting jvm arguments. My error stemmed from one of my jvm arguments being a file path that was not exposed through docker. Make sure use-spring-application-json is unchecked if you specify your jvm args this way. So this is valid for passing jvm arguments...

through docker /res/ maps to a folder on my c drive.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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