Commit cda9ac0
Only log class name on ToolCallingAutoConfiguration#ClassNotFoundException in getClassOrNull
Fixes spring-projects#4205
Fixes spring-projects#4249
Auto-cherry-pick to 1.0.x
The getClassOrNull method is designed to gracefully handle missing classes
by returning null, but was logging full stack traces for ClassNotFoundException
which could mislead users into thinking there's an actual problem.
Changes:
- Log only the class name when ClassNotFoundException occurs
- Add type safety check for RuntimeException subclasses
- Add separate handling for other exceptions with full stack trace
- Improve log message clarity to reduce user confusion
This maintains the expected behavior while providing cleaner, less alarming
log output for normal class-not-found scenarios.
Signed-off-by: Sun Yuhan <[email protected]>
Signed-off-by: 家娃 <[email protected]>1 parent 58643ee commit cda9ac0
File tree
1 file changed
+11
-2
lines changed- auto-configurations/models/tool/spring-ai-autoconfigure-model-tool/src/main/java/org/springframework/ai/model/tool/autoconfigure
1 file changed
+11
-2
lines changedLines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
130 | 136 | | |
131 | 137 | | |
132 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
133 | 142 | | |
134 | 143 | | |
135 | 144 | | |
| |||
0 commit comments