Read file from resources folder in Spring Boot

后端 未结 12 1092
盖世英雄少女心
盖世英雄少女心 2020-11-28 06:50

I\'m using Spring Boot and json-schema-validator. I\'m trying to read a file called jsonschema.json from the resources folder. I\'ve t

12条回答
  •  眼角桃花
    2020-11-28 07:28

    Spent way too much time coming back to this page so just gonna leave this here:

    File file = new ClassPathResource("data/data.json").getFile();
    

提交回复
热议问题