Bug description
When defining tools from Java methods, the callback logic fails if the method is not public or if it's located in a non-public class.
Environment
Spring AI: 1.0.0-SNAPSHOT
Java: 23
Expected behavior
Even if the class/method is not public, I'd expect the tool callback logic to work. It's good practice not to define tool methods as public, and make sure they are only used as part of an LLM workflow.
I have a solution suggestion. See MethodToolCallback.java. A working example is available here.
Minimal Complete Reproducible example
Example reproducing the issue is available here (check the /chat/method/non-public endpoint).