UploadCleanupService { @Scheduled(cron = "${upload.clean.cron}") public void clean() { log.info(repeat("-", 100)); log.info("Cleaning stale uploads"); log.info(repeat("-", 100)); log.info("In-progress multipart uploads: "); for (val upload : uploadService.listUploads()) { log.info(" - Upload: {}", formatUpload(upload)); if (isStale(upload)) { log.info("*** Cancelling stale upload: {}", formatUpload(upload)); try { val objectId = ObjectKeys.getObjectId(dataDir, upload.getKey()); uploadService.cancelUpload(objectId, upload.getUploadId()); } catch (Exception e) { log.error("Error cancelling stale upload: {}: {}", formatUpload(upload), e); } } } }  @Scheduled(cron = "${upload.clean.cron}") void clean();  }
@Test public void testClean() { val cleanupService = createCleanupService(); cleanupService.clean(); }