Start API proxy with WorkUtils

This commit is contained in:
张家训
2026-08-03 10:56:00 +08:00
parent 10b7f40e65
commit b604fb5006
8 changed files with 119 additions and 44 deletions
@@ -1,5 +1,6 @@
package com.example.workutils;
import com.example.workutils.biz.apidoc.application.ApiDebugProxyLifecycle;
import com.example.workutils.system.config.*;
import com.example.workutils.system.plugin.Plugin;
import com.example.workutils.system.plugin.PluginDescriptor;
@@ -38,6 +39,7 @@ public class WorkUtilsApplication implements CommandLineRunner {
private final PluginManager pluginManager;
private final WorkUtilsProperties properties;
private final SettingsService settingsService;
private final ApiDebugProxyLifecycle apiDebugProxyLifecycle;
/** 主窗口引用,供内嵌插件面板使用 */
private MainWindow mainWindow;
@@ -45,10 +47,12 @@ public class WorkUtilsApplication implements CommandLineRunner {
private SettingsWindow settingsWindow;
public WorkUtilsApplication(PluginManager pluginManager, WorkUtilsProperties properties,
SettingsService settingsService) {
SettingsService settingsService,
ApiDebugProxyLifecycle apiDebugProxyLifecycle) {
this.pluginManager = pluginManager;
this.properties = properties;
this.settingsService = settingsService;
this.apiDebugProxyLifecycle = apiDebugProxyLifecycle;
}
// ==================== 启动诊断 ====================
@@ -91,10 +95,15 @@ public class WorkUtilsApplication implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
if (args.length == 0) {
showMainWindow();
} else {
processCommand(args);
apiDebugProxyLifecycle.start();
try {
if (args.length == 0) {
showMainWindow();
} else {
processCommand(args);
}
} finally {
apiDebugProxyLifecycle.stop();
}
}