package uk.ac.ebi.biosamples.ebeye.util;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.util.ResourceUtils;

import java.io.FileNotFoundException;
import java.util.*;

@Service
public class LoadAttributeSet {
    private Set<String> attributeSet = new HashSet<>();

    public Set<String> getAllAttributes() throws FileNotFoundException {
        final Scanner scanner = new Scanner(ResourceUtils.getFile("classpath:most_common_attributes.list"));
        final List<String> list = new ArrayList<>();

        while (scanner.hasNextLine()){
            list.add(scanner.nextLine());
        }

        scanner.close();

        list.forEach(element -> {
            attributeSet.add(Arrays.asList(element.split(",")).get(0));
        });

        return attributeSet;
    }
}

@@ -35,16 +35,70 @@
 .util;%0A%0A
+import org.springframework.core.io.ClassPathResource;%0A
 import o
@@ -138,16 +138,16 @@
 ponent;%0A
-
 import o
@@ -271,16 +271,72 @@
 eption;%0A
+import java.io.IOException;%0Aimport java.io.InputStream;%0A
 import j
@@ -495,28 +495,18 @@
  throws 
-FileNotFound
+IO
 Exceptio
@@ -527,100 +527,154 @@
 nal 
-Scanner scanner = new Scanner(ResourceUtils.getFile(%22classpath:most_common_attributes.list%22)
+InputStream resource = new ClassPathResource(%22most_common_attributes.list%22).getInputStream();%0A        final Scanner scanner = new Scanner(resource
 );%0A 

Solve Spring ResourceUtils bug