Paste the code first
private static String basePath = Thread.currentThread().getContextClassLoader().getResource("").getPath();
Reason: The method is executed through the thread, so we can go back to the class loader through the thread, so as to get the path of the resource in this class loader.