Skip to content

Commit

Permalink
Fix deployed exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Pelayori committed Apr 28, 2024
1 parent 0682f6c commit e3ead5d
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

Expand All @@ -31,7 +33,7 @@ public class QuestionGeneratorService {

private final QuestionService questionService;

public static final String JSON_FILE_PATH = "src/main/resources/static/JSON/QuestionTemplates.json";
public static final String JSON_FILE_PATH = "static/JSON/QuestionTemplates.json";

private Deque<QuestionType> types = new ArrayDeque<>();

Expand All @@ -52,9 +54,9 @@ public QuestionGeneratorService(QuestionService questionService, Environment env
}

private void parseQuestionTypes() throws IOException {
File jsonFile = new File(JSON_FILE_PATH);
Resource resource = new ClassPathResource(JSON_FILE_PATH);
ObjectMapper objectMapper = new ObjectMapper();
json = objectMapper.readTree(jsonFile);
json = objectMapper.readTree(resource.getInputStream());
JsonNode categories = json.findValue("categories");
for (JsonNode category : categories) {
String categoryName = category.get("name").textValue();
Expand Down

0 comments on commit e3ead5d

Please sign in to comment.