0

I have created a microservice in springboot, there is folder under resource folder and then a file under this folder i,e.

resource
      mycustomfolder
                  myfile.txt

I am creating a bean, which filed populated by myfile

@Value("${file-path}")
    private String filePath;

 @Bean
    public MyBean byBean() throws IOException {
//read file path
        String path = ResourceUtils.getURL(filePath).getPath();
//populated by bean
        MyBean myBean = myservice.populatedMyBean(path);
        return myBean;
    }

filePath value is set in application.property

dataload-config-file=src/main/resources/mycustomfolder/myfile.txt

when i am executing this springboot app it's working file.

But when i am creating a jar of it and deploying with spring cloud data flow it giving me error on creating myBean showing exception cause

Caused by: java.io.FileNotFoundException: /tmp/spring-cloud-dataflow-4865534318197521357/test-1506882530191/test.process/src/main/resources/mycustomfolder/myfile.txt (No such file or directory)

why this is happning normally working fine, but throwing error with spring-cloud-dataflow?

Baba
  • 311
  • 1
  • 2
  • 12

1 Answers1

0

Spring Cloud Data Flow can only orchestrate Spring Cloud Stream (SCSt) or Spring Cloud Task (SCT) based microservice applications. It is unclear whether your Spring Boot application complies to previously mentioned frameworks.

Please use the SCSt and SCT samples for reference. If your application does comply with the SCSt/SCT programming model, it'd be better you share the source code for review.

Sabby Anandan
  • 5,636
  • 2
  • 12
  • 21