1

I would like to develop a workflow in Spring Cloud Data Flow where each task instance would have its behavior dictate by the parameters I would have give to it at creation.

For example, if I have a task that make a rest api call, I would like the url of the api parameterized.

How can I do that? I thought it was with the properties and/or arguments passed to the task at creation but it doesn't seems to work... If so, how can I get the properties/arguments passed to the task in my code? I try with the @ConfigurationProperties annotation but I couldn't make it work.

@ConfigurationProperties("helloworld")
public class HelloWorldTaskConfiguration {
    private String name = "Toto";
    public String getName() {
        return name;
    }
    public void setname(String name) {
        this.name = name;
    }
}
OphyTe
  • 68
  • 9
  • Your understanding is correct about passing properties is correct. Do you have a unit test on the task that verifies the properties are set in the Spring Environment? Do you have `@EnableConfigurationProperties(HelloWorldTaskConfiguration.class)` somewhere? – dturanski Jan 14 '21 at 16:08
  • I do not have this annotation cause I read that it wasn't mandatory anymore (https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.2-Release-Notes#configurationproperties-scanning) ... I'm in 2.4.1 but I haven't defined `@ConfigurationPropertiesScan` annotation, I'm gonna try. I'm gonna take your advise and write a unit test that verifies the properties as well. Thanks – OphyTe Jan 15 '21 at 09:44

0 Answers0