Commit ff03cc3
committed
Fix IllegalAccessException in MongoDbAtlasLocalContainerConnectionDetails.getSslBundle()
The original fix in commit 03d475e introduced a MethodHandles.unreflectSpecial()
approach to resolve a StackOverflowError, but this caused IllegalAccessException
due to incorrect usage of unreflectSpecial() for interface default methods.
The unreflectSpecial() method is designed for superclass method calls, not
interface default methods, and requires private access which caused:
"IllegalAccessException: no private access for invokespecial: interface
org.springframework.boot.autoconfigure.mongo.MongoConnectionDetails"
This fix replaces the complex reflection approach with simple interface
delegation using 'MongoConnectionDetails.super.getSslBundle()'. This solution:
- Eliminates IllegalAccessException by properly overriding with public access
- Avoids StackOverflowError by delegating to interface default method
- Removes all reflection code, making it simpler and more maintainable
- Works across all Spring Boot versions without version-specific checks
- Resolves access privilege conflict between interface and parent class
The interface default method returns null, which is the desired behavior
for SSL configuration when no custom SSL bundle is provided.
Fixes: https://github.com/spring-projects/spring-ai/actions/runs/16981113833
Signed-off-by: Mark Pollack <[email protected]>1 parent 8caffe8 commit ff03cc3
File tree
1 file changed
+3
-24
lines changed- spring-ai-spring-boot-testcontainers/src/main/java/org/springframework/ai/testcontainers/service/connection/mongo
1 file changed
+3
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 19 | | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
27 | 24 | | |
28 | 25 | | |
29 | | - | |
30 | 26 | | |
31 | 27 | | |
32 | 28 | | |
| |||
51 | 47 | | |
52 | 48 | | |
53 | 49 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | 50 | | |
61 | 51 | | |
62 | 52 | | |
| |||
79 | 69 | | |
80 | 70 | | |
81 | 71 | | |
82 | | - | |
| 72 | + | |
83 | 73 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 74 | + | |
| 75 | + | |
97 | 76 | | |
98 | 77 | | |
99 | 78 | | |
| |||
0 commit comments