This is an automated email from the ASF dual-hosted git repository.
zqr10159 pushed a commit to branch 2.0.0
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
The following commit(s) were added to refs/heads/2.0.0 by this push:
new 5b4cf11fe1 Prevent Spring AI auto chat startup
5b4cf11fe1 is described below
commit 5b4cf11fe18278b7c5debca5bce9c68a4c5fffbb
Author: Logic <[email protected]>
AuthorDate: Sat Jun 6 22:50:12 2026 +0800
Prevent Spring AI auto chat startup
---
.../src/main/resources/application-test.yml | 4 ++
.../src/main/resources/application.yml | 2 +
.../startup/SpringAiStartupConfigurationTest.java | 57 ++++++++++++++++++++++
3 files changed, 63 insertions(+)
diff --git a/hertzbeat-startup/src/main/resources/application-test.yml
b/hertzbeat-startup/src/main/resources/application-test.yml
index eaea0b66e8..36f97a3c1c 100644
--- a/hertzbeat-startup/src/main/resources/application-test.yml
+++ b/hertzbeat-startup/src/main/resources/application-test.yml
@@ -15,6 +15,10 @@
server:
port: ${random.int[10000,19999]}
spring:
+ ai:
+ model:
+ chat: none
+
datasource:
driver-class-name: org.h2.Driver
username: sa
diff --git a/hertzbeat-startup/src/main/resources/application.yml
b/hertzbeat-startup/src/main/resources/application.yml
index 5257b88c0a..d15574498d 100644
--- a/hertzbeat-startup/src/main/resources/application.yml
+++ b/hertzbeat-startup/src/main/resources/application.yml
@@ -23,6 +23,8 @@ spring:
local:
- prod
ai:
+ model:
+ chat: none
mcp:
server:
enabled: true
diff --git
a/hertzbeat-startup/src/test/java/org/apache/hertzbeat/startup/SpringAiStartupConfigurationTest.java
b/hertzbeat-startup/src/test/java/org/apache/hertzbeat/startup/SpringAiStartupConfigurationTest.java
new file mode 100644
index 0000000000..3d88d73a51
--- /dev/null
+++
b/hertzbeat-startup/src/test/java/org/apache/hertzbeat/startup/SpringAiStartupConfigurationTest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hertzbeat.startup;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import org.junit.jupiter.api.Test;
+
+class SpringAiStartupConfigurationTest {
+
+ @Test
+ void defaultStartupDisablesSpringAiChatAutoConfiguration() throws
IOException {
+ String applicationYaml =
readRepoFile("hertzbeat-startup/src/main/resources/application.yml");
+ String applicationTestYaml =
readRepoFile("hertzbeat-startup/src/main/resources/application-test.yml");
+
+ assertThat(applicationYaml)
+ .contains("ai:")
+ .contains("model:")
+ .contains("chat: none");
+ assertThat(applicationTestYaml)
+ .contains("ai:")
+ .contains("model:")
+ .contains("chat: none");
+ }
+
+ private static String readRepoFile(String relativePath) throws IOException
{
+ Path repoRoot = repoRoot();
+ return Files.readString(repoRoot.resolve(relativePath));
+ }
+
+ private static Path repoRoot() {
+ Path userDir =
Path.of(System.getProperty("user.dir")).toAbsolutePath();
+ if (Files.exists(userDir.resolve("pom.xml"))
+ && Files.exists(userDir.resolve("hertzbeat-startup/pom.xml")))
{
+ return userDir;
+ }
+ return userDir.getParent();
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]