Fixes: #1591

Issue: https://github.com/spring-projects/spring-ai/issues/1591

Comment From: markpollack

merged edc70031dc8f27669d498d92828e7609e4cd6c08