Skip to content

Commit

Permalink
fix config
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Schuehly committed Aug 16, 2023
1 parent 7dc8160 commit a7b7326
Showing 1 changed file with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,27 @@ class ViewComponentAutoConfiguration(
@ComponentScan("de.tschuehly.spring.viewcomponent.core.action")
class ViewActionConfiguration {}

@Bean
@ConditionalOnProperty("spring.view-component.local-development")
fun viewComponentFileSystemWatcher(applicationContext: ApplicationContext): FileSystemWatcher {
val fileSystemWatcher = FileSystemWatcher(true, Duration.ofMillis(500), Duration.ofMillis(300))
if (File("src/main/kotlin").isDirectory) {
fileSystemWatcher.addSourceDirectory(File("src/main/kotlin/"))
}
if (File("src/main/java").isDirectory) {
fileSystemWatcher.addSourceDirectory(File("src/main/java/"))
}
fileSystemWatcher.addListener(ViewComponentChangeListener(applicationContext))
return fileSystemWatcher
}

@Configuration
@ConditionalOnProperty("spring.view-component.local-development")
class StartWatcherConfiguration(
val fileSystemWatcher: FileSystemWatcher
class LocalDevConfig(
) {
@PostConstruct
fun startWatcher() {
fun startWatcher(fileSystemWatcher: FileSystemWatcher) {
fileSystemWatcher.start()
}
@Bean
fun viewComponentFileSystemWatcher(applicationContext: ApplicationContext): FileSystemWatcher {
val fileSystemWatcher = FileSystemWatcher(true, Duration.ofMillis(500), Duration.ofMillis(300))
if (File("src/main/kotlin").isDirectory) {
fileSystemWatcher.addSourceDirectory(File("src/main/kotlin/"))
}
if (File("src/main/java").isDirectory) {
fileSystemWatcher.addSourceDirectory(File("src/main/java/"))
}
fileSystemWatcher.addListener(ViewComponentChangeListener(applicationContext))
return fileSystemWatcher
}


}
}

0 comments on commit a7b7326

Please sign in to comment.