Skip to content

Commit

Permalink
fix localdev config
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Schuehly committed Aug 17, 2023
1 parent a7b7326 commit e8f0b49
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@ class ViewComponentAutoConfiguration(
@Configuration
@ConditionalOnProperty("spring.view-component.local-development")
class LocalDevConfig(
private val fileSystemWatcher: FileSystemWatcher
) {
@PostConstruct
fun startWatcher(fileSystemWatcher: FileSystemWatcher) {
fun startWatcher() {
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
}
@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
}
}
13 changes: 12 additions & 1 deletion examples/thymeleaf-example/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
rootProject.name = "thymeleaf-example"
rootProject.name = "thymeleaf-example"

includeBuild("..\\..\\thymeleaf"){
dependencySubstitution {
substitute(module("de.tschuehly:spring-view-component-thymeleaf")).using(project(":"))
}
}
includeBuild("..\\..\\core"){
dependencySubstitution {
substitute(module("de.tschuehly:spring-view-component-core")).using(project(":"))
}
}

0 comments on commit e8f0b49

Please sign in to comment.