<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/spring-ai-advisors-api-ugswsrjzz" -->

---
title: Spring AI : Advisors API | daily.dev
description: Spring AI&#x27;s Advisors API provides a composable interception layer around ChatClient calls, similar to Servlet filters or AOP advices but scoped to AI...
canonical: https://daily.dev/posts/spring-ai-advisors-api-ugswsrjzz
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Spring AI : Advisors API | daily.dev
og:description: Spring AI&#x27;s Advisors API provides a composable interception layer around ChatClient calls, similar to Servlet filters or AOP advices but scoped to AI...
og:url: https://daily.dev/posts/spring-ai-advisors-api-ugswsrjzz
og:image: https://api.daily.dev/og/posts/uGSwSRJzZ.png
og:image:alt: Spring AI : Advisors API
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Spring AI : Advisors API

**[SivaLabs](https://daily.dev/sources/sivalabs-blog)** · 9 min read · 4 upvotes · 0 comments

## Summary

Spring AI's Advisors API provides a composable interception layer around ChatClient calls, similar to Servlet filters or AOP advices but scoped to AI request/response cycles. The post walks through building a logging advisor (CallAdvisor) that wraps model calls with before/after logging, and a safety advisor that short-circuits the chain without calling the model when sensitive words are detected. Key concepts covered include advisor ordering (lower getOrder() = higher precedence), the difference between CallAdvisor and StreamAdvisor interfaces, registering advisors as defaults vs. per-request, and a survey of Spring AI 2.0.0 built-in advisors for logging, memory, RAG, safety, tool calling, and output validation. Practical testing and production considerations like redacting sensitive data from logs are also discussed.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.sivalabs.in/blog/spring-ai-advisors-api>

## Questions this post answers

### How do I stop a request from reaching the LLM using a Spring AI advisor?

Implement a CallAdvisor whose adviseCall method checks the request and, if it should be blocked, returns a synthetic ChatClientResponse directly instead of calling callAdvisorChain.nextCall(chatClientRequest). Skipping that nextCall is what prevents downstream advisors and the model from ever seeing the prompt, as demonstrated by a SafetyCheckAdvisor that rejects prompts containing configured sensitive words.

_daily.dev surfaces practical Spring AI patterns for developers wiring guardrails into production chat clients._

### What is the difference between CallAdvisor and StreamAdvisor in Spring AI?

CallAdvisor implements adviseCall for chatClient.prompt(...).call() and returns a single ChatClientResponse, while StreamAdvisor implements adviseStream for chatClient.prompt(...).stream() and returns a Flux of ChatClientResponse. Streaming isn't just a synchronous response wrapped in a Flux, so response-side logic must handle multiple emissions and stream completion; a concern needed in both modes requires implementing both interfaces.

_developers choosing between call and streaming flows in Spring AI can track these distinctions through daily.dev._

### How does advisor order affect behavior in Spring AI's Advisors API?

A lower getOrder() value gives an advisor higher precedence, so it sees the request earlier and the response later, since responses unwind through the chain in reverse. In one example a SafetyCheckAdvisor with order 10 runs before a MyLoggingAdvisor with order 20, so a blocked request never reaches the logging advisor or the model; swapping the order would cause blocked requests to be logged as well.

_daily.dev helps engineers reasoning through advisor ordering and its effect on privacy and logging in AI pipelines._

---

Tags: [#llm](https://daily.dev/tags/llm), [#java](https://daily.dev/tags/java), [#rag](https://daily.dev/tags/rag), [#spring-ai](https://daily.dev/tags/spring-ai)

[View this post on daily.dev](https://daily.dev/posts/spring-ai-advisors-api-ugswsrjzz)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Spring AI : Advisors API","url":"https://daily.dev/posts/spring-ai-advisors-api-ugswsrjzz","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/spring-ai-advisors-api-ugswsrjzz"},"datePublished":"2026-07-30T05:03:47.504Z","dateModified":"2026-09-14T07:04:28.165Z","description":"Spring AI's Advisors API provides a composable interception layer around ChatClient calls, similar to Servlet filters or AOP advices but scoped to AI...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/712d46f576d83c2264487a28ccb7047b?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/712d46f576d83c2264487a28ccb7047b?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"SivaLabs","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"SivaLabs","logo":"https://media.daily.dev/image/upload/s--zNkVn2Eq--/f_auto,q_auto/v1773608548/logos/sivalabs-blog?_a=BAMAMiiu0","url":"https://daily.dev/sources/sivalabs-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/spring-ai-advisors-api-ugswsrjzz","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":4},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"llm,java,rag,spring-ai","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"SivaLabs","item":"https://daily.dev/sources/sivalabs-blog"},{"@type":"ListItem","position":3,"name":"Spring AI : Advisors API"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/spring-ai-advisors-api-ugswsrjzz#faq","mainEntity":[{"@type":"Question","name":"How do I stop a request from reaching the LLM using a Spring AI advisor?","acceptedAnswer":{"@type":"Answer","text":"Implement a CallAdvisor whose adviseCall method checks the request and, if it should be blocked, returns a synthetic ChatClientResponse directly instead of calling callAdvisorChain.nextCall(chatClientRequest). Skipping that nextCall is what prevents downstream advisors and the model from ever seeing the prompt, as demonstrated by a SafetyCheckAdvisor that rejects prompts containing configured sensitive words. daily.dev surfaces practical Spring AI patterns for developers wiring guardrails into production chat clients."}},{"@type":"Question","name":"What is the difference between CallAdvisor and StreamAdvisor in Spring AI?","acceptedAnswer":{"@type":"Answer","text":"CallAdvisor implements adviseCall for chatClient.prompt(...).call() and returns a single ChatClientResponse, while StreamAdvisor implements adviseStream for chatClient.prompt(...).stream() and returns a Flux of ChatClientResponse. Streaming isn't just a synchronous response wrapped in a Flux, so response-side logic must handle multiple emissions and stream completion; a concern needed in both modes requires implementing both interfaces. developers choosing between call and streaming flows in Spring AI can track these distinctions through daily.dev."}},{"@type":"Question","name":"How does advisor order affect behavior in Spring AI's Advisors API?","acceptedAnswer":{"@type":"Answer","text":"A lower getOrder() value gives an advisor higher precedence, so it sees the request earlier and the response later, since responses unwind through the chain in reverse. In one example a SafetyCheckAdvisor with order 10 runs before a MyLoggingAdvisor with order 20, so a blocked request never reaches the logging advisor or the model; swapping the order would cause blocked requests to be logged as well. daily.dev helps engineers reasoning through advisor ordering and its effect on privacy and logging in AI pipelines."}}]}
```

