WatchForMainRun

首次執行多個 watcher 並對變更事件進行去抖動,重新執行生成管道。


必需與選擇的 watcher

entityConfig / entityFactory

必填

handlerConfig / handlerFactory

必填

swaggerConfig / swaggerFactory

必填

asyncApiFactory

選擇性。對於需要 RSocket AsyncAPI 的項目,請添加。

配置選項

debounceMillis(long)

基本 400ms

trigger(Path)

重新載入觸發檔案。若省略,則使用 classpath 根目錄的 .reloadtrigger

classpathWatchPaths(String)

以 CSV 或 OS 路徑分隔符添加 classpath 根目錄

...Config

使用 config 物件創建基本的 watcher factory

...Factory

直接延遲注入 watcher 創建方式

新增 AsyncAPI

java
var asyncConfig = RsoketAsyncApiJsonFileWatcher.Config.builder().build();

var mainConfig = WatchForMainRun.Config.builder()
    .entityConfig(entityConfig)
    .handlerConfig(handlerConfig)
    .swaggerConfig(swaggerConfig)
    .asyncApiFactory(() -> new RsoketAsyncApiJsonFileWatcher(asyncConfig))
    .build();

生命週期

作為 Spring Bean 使用時,在 @PostConstruct 中調用 runner.start(),在 @PreDestroy 中調用 runner.stop()。不要隱藏啟動失敗,應在本地控制台檢查堆疊追蹤,以便及時發現生成遺漏問題。

© 2026 Byeolnaerim. 版權所有。介紹隱私政策