@Bean public FileSystemWatcherFactory fileSystemWatcherFactory() { return new FileSystemWatcherFactory() { @Override public FileSystemWatcher getFileSystemWatcher() { return newFileSystemWatcher(); } }; }
@Bean public FileSystemWatcherFactory getFileSystemWatcherFactory() { return new FileSystemWatcherFactory() { @Override public FileSystemWatcher getFileSystemWatcher() { return newFileSystemWatcher(); } }; }
/** * Create a new {@link ClassPathFileSystemWatcher} instance. * @param fileSystemWatcherFactory a factory to create the underlying * {@link FileSystemWatcher} used to monitor the local file system * @param restartStrategy the classpath restart strategy * @param urls the URLs to watch */ public ClassPathFileSystemWatcher(FileSystemWatcherFactory fileSystemWatcherFactory, ClassPathRestartStrategy restartStrategy, URL[] urls) { Assert.notNull(fileSystemWatcherFactory, "FileSystemWatcherFactory must not be null"); Assert.notNull(urls, "Urls must not be null"); this.fileSystemWatcher = fileSystemWatcherFactory.getFileSystemWatcher(); this.restartStrategy = restartStrategy; this.fileSystemWatcher.addSourceFolders(new ClassPathFolders(urls)); }
@Test public void urlsMustNotBeNull() throws Exception { this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage("Urls must not be null"); URL[] urls = null; new ClassPathFileSystemWatcher(mock(FileSystemWatcherFactory.class), mock(ClassPathRestartStrategy.class), urls); }
FileWatchingFailureHandler(FileSystemWatcherFactory fileSystemWatcherFactory) { this.fileSystemWatcherFactory = fileSystemWatcherFactory; }