What is Spring AI?
Spring AI is the AI module for the Spring Framework, the most widely used framework in enterprise Java. It brings AI capabilities into the Spring ecosystem with the patterns Java developers already know: auto-configuration, dependency injection, and property-driven setup.
Spring AI supports chat models, embeddings, image generation, and RAG through a consistent API. It integrates with vector stores like pgvector and Milvus, and includes document loaders for PDFs, HTML, and other formats. The ChatClient API feels like using RestTemplate or WebClient: familiar, strongly typed, and testable.
Configuration is done through application.properties. You set spring.ai.openai.base-url to EUrouter's endpoint and spring.ai.openai.api-key to your EUrouter key. That's it. Your existing ChatClient beans, service classes, and controller endpoints all keep working, but the model calls now go through Europe.
Quick to integrate
A few lines of code is all it takes. Swap your base URL and you are routed through EUrouter.
1# application.properties
2spring.ai.openai.api-key=eur-...
3spring.ai.openai.base-url=https://api.eurouter.ai/v1
4spring.ai.openai.chat.options.model=gpt-4oGet started in minutes
Follow these steps to connect your application to EUrouter.
Add Spring AI dependencies
Add the Spring AI OpenAI starter to your pom.xml or build.gradle.
1<dependency>
2 <groupId>org.springframework.ai</groupId>
3 <artifactId>spring-ai-openai-spring-boot-starter</artifactId>
4</dependency>Configure the endpoint
Set the EUrouter base URL and API key in your application properties.
1spring.ai.openai.api-key=eur-...
2spring.ai.openai.base-url=https://api.eurouter.ai/v1
3spring.ai.openai.chat.options.model=gpt-4oUse ChatClient
Inject and use the ChatClient as you normally would. All calls route through EUrouter.
1@Service
2public class AiService {
3
4 private final ChatClient chatClient;
5
6 public AiService(ChatClient.Builder builder) {
7 this.chatClient = builder.build();
8 }
9
10 public String summarize(String text) {
11 return chatClient.prompt()
12 .user("Summarize: " + text)
13 .call()
14 .content();
15 }
16}Why use Spring AI with EUrouter
Spring-native AI in Europe
Spring AI follows the same conventions as every other Spring module. You configure it through properties, inject beans, and write tests the way you always do. EUrouter plugs in through two properties in application.properties. No custom code, no additional libraries, no workarounds.
- Standard Spring Boot auto-configuration picks up your EUrouter settings
- ChatClient bean works with dependency injection as expected
- Compatible with Spring Cloud Config for centralized property management
- Spring Security, Spring Actuator, and Spring Cloud all work alongside it
Enterprise Java AI
For large organizations running Spring-based systems, AI features need to meet the same compliance standards as the rest of the stack. Banks, insurance companies, and healthcare providers already use Spring for their regulated workloads. With EUrouter, their AI features get the same EU data residency as their transaction processing and customer data handling.
- Fits into existing enterprise Spring architecture without special accommodations
- EU data residency meets requirements for regulated industries (finance, healthcare, legal)
- Integrates with Spring Security so AI endpoints have the same auth as your other APIs
- Observable through Spring Actuator health checks and metrics endpoints
RAG with Spring and EUrouter
Spring AI has built-in support for RAG: document loaders, text splitters, vector store integrations, and retrieval chains. The LLM and embedding calls are the part that often goes to the US. With EUrouter, those calls stay in Europe. Host your vector store in the EU too, and your entire RAG pipeline is GDPR-compliant.
- Embeddings API available through EUrouter for document indexing
- Compatible with EU-hosted vector stores: pgvector (on Neon or Supabase), Milvus, Qdrant
- Document loaders and text splitters work as-is with no changes needed
- End-to-end GDPR-compliant RAG pipeline, fully in Java, fully in Europe