Skip to content

Commit 2c3e90b

Browse files
Development: Fix server startup when only atlas is enabled (#11655)
1 parent bca0ed7 commit 2c3e90b

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

.github/workflows/bean-instantiations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
MAX_STARTUP_DEPENDENCY_CHAIN_LENGTH: 9
1818
MAX_DEFERRED_CHAIN_LENGTH: 16
1919
MIN_INSTANTIATED_BEANS: 20
20-
MAX_INSTANTIATED_BEANS: 101
20+
MAX_INSTANTIATED_BEANS: 102
2121
MIN_DEFERRED_CHAIN_LENGTH: 1
2222

2323
steps:

.github/workflows/quality.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
complex_beans=$(echo "$output" | grep -o "Found [0-9]* Spring beans with constructors having more than" | grep -o "[0-9]*")
3636
3737
# TODO these values should become zero in the future
38-
max_large_classes=9
38+
max_large_classes=11
3939
max_complex_beans=10
4040
4141
echo "=========================================="

src/main/java/de/tum/cit/aet/artemis/core/config/SpringAIAutoConfigurationFilter.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212
* that conditionally excludes certain Spring AI Azure/OpenAI auto-configurations from being
1313
* loaded into the application context.
1414
* <p>
15-
* This filter checks the value of the property defined by
16-
* {@link Constants#HYPERION_ENABLED_PROPERTY_NAME}. If the property is {@code false} or absent,
17-
* all auto-configuration fully qualified class names starting with org.springframework.ai will be
18-
* filtered out and not applied. If the property is {@code true}, the filter allows all
15+
* This filter checks whether Hyperion or Atlas modules are enabled. If both are disabled,
16+
* all autoconfiguration fully qualified class names starting with org.springframework.ai will be
17+
* filtered out and not applied. If either module is enabled, the filter allows all
1918
* auto-configurations to proceed (it does not re-include anything excluded elsewhere such
2019
* as through {@code spring.autoconfigure.exclude} in YAML).
2120
* <p>
22-
* This mechanism is useful to prevent unnecessary bean creation when the
23-
* "Hyperion" feature is disabled, while still permitting the application to start normally.
21+
* This mechanism is useful to prevent unnecessary bean creation when both the
22+
* "Hyperion" and "Atlas" features are disabled, while still permitting the application to start normally.
2423
* <p>
2524
* Note that this filter only affects the specified classes. Other exclusions (e.g. via
2625
* {@code spring.autoconfigure.exclude} in {@code application.yml}) still apply independently.
@@ -38,6 +37,8 @@ public class SpringAIAutoConfigurationFilter implements AutoConfigurationImportF
3837
@Override
3938
public boolean[] match(String[] autoConfigurationClasses, AutoConfigurationMetadata metadata) {
4039
boolean hyperionEnabled = env.getProperty(Constants.HYPERION_ENABLED_PROPERTY_NAME, Boolean.class, false);
40+
boolean atlasEnabled = env.getProperty(Constants.ATLAS_ENABLED_PROPERTY_NAME, Boolean.class, false);
41+
boolean springAIEnabled = hyperionEnabled || atlasEnabled;
4142

4243
boolean[] matches = new boolean[autoConfigurationClasses.length];
4344
for (int i = 0; i < autoConfigurationClasses.length; i++) {
@@ -48,9 +49,9 @@ public boolean[] match(String[] autoConfigurationClasses, AutoConfigurationMetad
4849
continue;
4950
}
5051

51-
matches[i] = hyperionEnabled || !fullyQualifiedClassName.startsWith("org.springframework.ai");
52+
matches[i] = springAIEnabled || !fullyQualifiedClassName.startsWith("org.springframework.ai");
5253
if (!matches[i]) {
53-
log.debug("Excluding auto-configuration: {} because Hyperion is disabled", fullyQualifiedClassName);
54+
log.debug("Excluding auto-configuration: {} because Hyperion and Atlas are disabled", fullyQualifiedClassName);
5455
}
5556
}
5657
return matches;

0 commit comments

Comments
 (0)