Created
November 9, 2017 18:24
-
-
Save dario61081/44083ac0f89060831512e445421fc485 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package py.com.puntofarma; | |
import org.apache.log4j.Logger; | |
import org.springframework.boot.devtools.filewatch.ChangedFiles; | |
import org.springframework.boot.devtools.filewatch.FileChangeListener; | |
import org.springframework.boot.devtools.filewatch.FileSystemWatcher; | |
import org.springframework.stereotype.Component; | |
import java.io.File; | |
import java.nio.file.Watchable; | |
import java.util.Set; | |
@Component | |
public class WatcherTasks { | |
static final Logger LOG = Logger.getLogger(WatcherTasks.class); | |
private FileSystemWatcher fileSystemWatcher; | |
public WatcherTasks() { | |
File file = new File("/usr/local/webservices"); | |
fileSystemWatcher = new FileSystemWatcher(); | |
fileSystemWatcher.addSourceFolder(file); | |
fileSystemWatcher.addListener(new FileChangeListener() { | |
@Override | |
public void onChange(Set<ChangedFiles> set) { | |
LOG.error(set.toString()); | |
} | |
}); | |
fileSystemWatcher.start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment