---
title: "Spring AI 2.0 architecture and project setup"
chapter: "02"
---

# Spring AI 2.0 architecture and project setup

Spring AI 2.0 provides portable Java APIs for chat, embeddings, images, audio,
vector stores, tools, memory, RAG, MCP, evaluation, and observability. It uses
Spring Boot 4.x and Spring Framework 7.

## Dependency management

```xml
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.springframework.ai</groupId>
      <artifactId>spring-ai-bom</artifactId>
      <version>2.0.0</version>
      <type>pom</type><scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>
```

Add only the provider and vector-store starters the service actually uses:

```xml
<dependency>
  <groupId>org.springframework.ai</groupId>
  <artifactId>spring-ai-starter-model-openai</artifactId>
</dependency>
<dependency>
  <groupId>org.springframework.ai</groupId>
  <artifactId>spring-ai-starter-vector-store-pgvector</artifactId>
</dependency>
```

Spring AI 2.0 focuses its core providers on OpenAI, Anthropic, Bedrock, Google
GenAI, Mistral, DeepSeek, and Ollama. It prefers vendor SDK integrations so new
provider capabilities can arrive without pretending every provider is equal.

## API levels

- `ChatClient`: normal fluent application API;
- `ChatModel`: lower-level model abstraction;
- Advisors: reusable interception/orchestration such as memory, RAG, logging,
  tool execution, and semantic cache;
- provider options: escape hatch for capabilities that are not portable.

## Configuration ownership

Keep secrets outside source. Bind provider endpoints, model roles, timeouts,
and budgets through validated configuration. Fail startup when a required
provider is absent; allow an explicitly designed degraded mode otherwise.

## Upgrade warning

Spring AI 2.0 includes breaking starter names, immutable option builders,
Jackson 3, JSpecify null-safety, and tool-calling lifecycle changes. Do not
paste 1.x examples into a 2.0 application without the upgrade notes.

## Feynman check

Spring AI is an adapter and orchestration toolbox. Explain what business rules,
data permissions, and reliability work still belong to your application.
