code: public static Resource temporaryDirectory() {
        File tempDir = new File(SystemInfo.JAVA_IO_TMPDIR);
        String baseName = System.currentTimeMillis() + "-";
        for (int i = 0; i < 1_000_000; i++) {
           File tmp = new File(tempDir, baseName + i);
           if (tmp.mkdir()) {
              return new FileResource(tmp);
           }
        }
        throw new RuntimeException("Unable to create temp directory");
     }
docs: Creates a new Resource that points to a temporary directory.
  
  @return A resource which is a temporary directory on disk