Read file from resources folder in Spring Boot

后端 未结 12 1128
盖世英雄少女心
盖世英雄少女心 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:19

    create json folder in resources as subfolder then add json file in folder then you can use this code :

    import com.fasterxml.jackson.core.type.TypeReference;

    InputStream is = TypeReference.class.getResourceAsStream("/json/fcmgoogletoken.json");

    this works in Docker.

提交回复
热议问题