Integration patterns for LangChain4j with Spring Boot. Auto-configuration, dependency injection, and Spring ecosystem integration. Use when embedding LangChain4j into Spring Boot applications.
/plugin marketplace add giuseppe-trisciuoglio/developer-kit/plugin install developer-kit@giuseppe.trisciuoglioThis skill is limited to using the following tools:
references/configuration.mdreferences/examples.mdreferences/references.mdTo accomplish integration of LangChain4j with Spring Boot applications, follow this comprehensive guidance covering auto-configuration, declarative AI Services, chat models, embedding stores, and production-ready patterns for building AI-powered applications.
To accomplish integration of LangChain4j with Spring Boot when:
LangChain4j Spring Boot integration provides declarative AI Services through Spring Boot starters, enabling automatic configuration of AI components based on properties. The integration combines the power of Spring dependency injection with LangChain4j's AI capabilities, allowing developers to create AI-powered applications using interface-based definitions with annotations.
To accomplish basic setup of LangChain4j with Spring Boot:
Add Dependencies:
<!-- Core LangChain4j -->
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-spring-boot-starter</artifactId>
<version>1.8.0</version> // Use latest version
</dependency>
<!-- OpenAI Integration -->
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-open-ai-spring-boot-starter</artifactId>
<version>1.8.0</version>
</dependency>
Configure Properties:
# application.properties
langchain4j.open-ai.chat-model.api-key=${OPENAI_API_KEY}
langchain4j.open-ai.chat-model.model-name=gpt-4o-mini
langchain4j.open-ai.chat-model.temperature=0.7
Create Declarative AI Service:
@AiService
interface CustomerSupportAssistant {
@SystemMessage("You are a helpful customer support agent for TechCorp.")
String handleInquiry(String customerMessage);
}
To accomplish Spring Boot configuration for LangChain4j:
Property-Based Configuration: Configure AI models through application properties for different providers.
Manual Bean Configuration: For advanced configurations, define beans manually using @Configuration.
Multiple Providers: Support for multiple AI providers with explicit wiring when needed.
To accomplish interface-based AI service definitions:
Basic AI Service: Create interfaces with @AiService annotation and define methods with message templates.
Streaming AI Service: Implement streaming responses using Reactor or Project Reactor.
Explicit Wiring: Specify which model to use with @AiService(wiringMode = EXPLICIT, chatModel = "modelBeanName").
To accomplish RAG system implementation:
Embedding Stores: Configure various embedding stores (PostgreSQL/pgvector, Neo4j, Pinecone, etc.).
Document Ingestion: Implement document processing and embedding generation.
Content Retrieval: Set up content retrieval mechanisms for knowledge augmentation.
To accomplish AI tool integration:
Spring Component Tools: Define tools as Spring components with @Tool annotations.
Database Access Tools: Create tools for database operations and business logic.
Tool Registration: Automatically register tools with AI services.
To understand implementation patterns, refer to the comprehensive examples in references/examples.md.
To accomplish production-ready AI applications:
For detailed API references, advanced configurations, and additional patterns, refer to:
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.