Fixes gh-503

Comment From: tzolov

Thanks @ThomasVitale

Comment From: tzolov

@ThomasVitale please make sure to runt the tests: https://github.com/spring-projects/spring-ai/actions/runs/8409750742/job/23027400577

Comment From: ThomasVitale

@tzolov ouch, I was too zealous and didn't realise I didn't push all the commits (I had actually fixed the test), sorry about that.