Mule: Unable to locate .json file when Deployable archive move to CloudHub

前端 未结 1 1378
余生分开走
余生分开走 2021-01-26 17:07

Could someone please help. I have read you recommendation but not able to understand that. I have to read one json file in cloudhub.

In my local repositories I have kep

1条回答
  •  走了就别回头了
    2021-01-26 17:34

    You need to load your application resources from the classpath, not from a path that is related to the original project structure.

    Files in src\main\resources end-up at the root of the classpath in the packaged application. So the following should provide you with the file's content as a stream:

    Thread.currentThread().getContextClassLoader().getResourceAsStream("input.json");
    

    0 讨论(0)
提交回复
热议问题