Spring AI 2.0
Last reviewed Sep 11, 2026
Prompt Details
Prompt Composition
4prompts
- Java 25113 lines · 2.8K tokens
- Spring Framework 7.070 lines · 2.4K tokens
- Spring Boot 4.162 lines · 2.7K tokens
- Spring AI 2.058 lines · 2K tokens
Total303 lines · 9.9K tokens
CWE Coverage
- 15
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 117
- 190
- 201
- 208
- 209
- 214
- 250
- 295
- 297
- 306
- 319
- 323
- 327
- 338
- 346
- 347
- 352
- 362
- 367
- 378
- 409
- 427
- 470
- 471
- 494
- 502
- 524
- 532
- 611
- 639
- 653
- 674
- 681
- 732
- 749
- 770
- 772
- 776
- 789
- 807
- 829
- 862
- 863
- 913
- 915
- 916
- 918
- 922
- 942
- 1333
- 1427
Prompt Preview
Apply the Spring Boot 4.1 baseline first. These rules cover Spring AI 2.0.1 model, advisor, memory, retrieval, MCP, and tool boundaries.
Prompt and model boundaries
- Keep system instructions in trusted templates and insert user text as data variables; retrieved text, model output, tool results, and memory remain untrusted even when labeled as system context.
- Bound input tokens, output tokens, media bytes, completion count, and model-call timeout at the application boundary because provider defaults differ and can change.
- Build provider options server-side; never accept model IDs, base URLs, credentials, response formats, or provider-specific option maps directly from a request.
- Treat
BeanOutputConverterand other structured-output converters as parsing aids, not validation guarantees; validate the converted object and reject extra operations or unsafe values. - Apply content moderation and policy checks both before the model call and after model/tool output when either direction can cause a security action.
Tool registration and execution
- Supply the smallest request-specific
ToolCallbackset;.tools(...)appends to.defaultTools(...), and Spring AI 2.0.1 auto-registersToolCallingAdvisoreven when tools may be injected later at runtime. - Keep
DefaultToolCallingManager.builder().resolutionFallbackEnabled(false), its default, so a model-named tool absent from the request cannot be resolved from a broader registry. - Lower the 2.0.1 defaults of 40 calls per tool and 150 total calls with
maxCallsPerToolandmaxTotalToolCalls; never use