Skip to content

CAMEL-22850: Use LangChain4j Spring Boot starters in Camel Spring Boot#20919

Merged
gnodet merged 4 commits intoapache:mainfrom
gnodet:feature/CAMEL-22850
Jan 23, 2026
Merged

CAMEL-22850: Use LangChain4j Spring Boot starters in Camel Spring Boot#20919
gnodet merged 4 commits intoapache:mainfrom
gnodet:feature/CAMEL-22850

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Jan 19, 2026

CAMEL-22850: Integrate LangChain4j Spring Boot starters in Camel Spring Boot
This commit integrates LangChain4j Spring Boot starters with Apache Camel's
langchain4j components, enabling auto-configuration and simplified setup for
Spring Boot applications.

Changes:

  • Updated camel-langchain4j-chat component documentation to include Spring Boot
    starter integration examples with auto-configuration
  • Updated camel-langchain4j-agent component documentation with Spring Boot
    starter usage patterns
  • Updated camel-langchain4j-embeddings component documentation with embedding
    model auto-configuration examples
  • Added comprehensive LangChain4j Spring Boot Integration guide covering:
    • Available LangChain4j Spring Boot starters for various LLM providers
    • Configuration examples for OpenAI, Azure OpenAI, Ollama, and others
    • Complete working examples with RAG, streaming, and multi-provider setups
    • Best practices for production deployments
    • Troubleshooting guide
  • Created example Spring Boot application demonstrating the integration:
    • Maven POM with proper dependencies
    • Profile-based configuration (dev with Ollama, prod with OpenAI)
    • Camel routes using auto-configured LangChain4j beans
    • REST API endpoints for chat interactions

Benefits:

  • Simplified configuration through Spring Boot auto-configuration
  • Type-safe configuration properties with IDE support
  • Reduced boilerplate code for LLM integration
  • Consistent configuration approach across different providers
  • Production-ready setup with health checks and metrics

The integration allows users to leverage LangChain4j's Spring Boot starters
(langchain4j-open-ai-spring-boot-starter, langchain4j-ollama-spring-boot-starter,
etc.) for automatic bean configuration, while seamlessly using these beans in
Camel's langchain4j components for AI/LLM integration workflows.

…ng Boot

This commit integrates LangChain4j Spring Boot starters with Apache Camel's
langchain4j components, enabling auto-configuration and simplified setup for
Spring Boot applications.

Changes:
- Updated camel-langchain4j-chat component documentation to include Spring Boot
  starter integration examples with auto-configuration
- Updated camel-langchain4j-agent component documentation with Spring Boot
  starter usage patterns
- Updated camel-langchain4j-embeddings component documentation with embedding
  model auto-configuration examples
- Added comprehensive LangChain4j Spring Boot Integration guide covering:
  * Available LangChain4j Spring Boot starters for various LLM providers
  * Configuration examples for OpenAI, Azure OpenAI, Ollama, and others
  * Complete working examples with RAG, streaming, and multi-provider setups
  * Best practices for production deployments
  * Troubleshooting guide
- Created example Spring Boot application demonstrating the integration:
  * Maven POM with proper dependencies
  * Profile-based configuration (dev with Ollama, prod with OpenAI)
  * Camel routes using auto-configured LangChain4j beans
  * REST API endpoints for chat interactions

Benefits:
- Simplified configuration through Spring Boot auto-configuration
- Type-safe configuration properties with IDE support
- Reduced boilerplate code for LLM integration
- Consistent configuration approach across different providers
- Production-ready setup with health checks and metrics

The integration allows users to leverage LangChain4j's Spring Boot starters
(langchain4j-open-ai-spring-boot-starter, langchain4j-ollama-spring-boot-starter,
etc.) for automatic bean configuration, while seamlessly using these beans in
Camel's langchain4j components for AI/LLM integration workflows.
This commit addresses several issues identified during code review:

1. Fixed Bean Names
   - Corrected bean references from 'chatModel' to 'chatLanguageModel'
   - This matches LangChain4j's actual auto-configured bean names
   - Updated all component documentation and examples

2. Added Multi-DSL Examples
   - Added tabs for Java, YAML, and XML examples in component docs
   - Follows Camel documentation best practices
   - Makes examples more accessible to users of different DSLs

3. Improved Version References
   - Changed 'x.x.x' placeholders to actual version '1.10.0'
   - Added comments to guide users on version selection
   - More explicit and helpful for users

4. Enhanced Example Application
   - Added .gitignore file for the example project
   - Created ChatRouteTest.java with integration tests
   - Tests demonstrate proper usage and include environment checks
   - Follows Camel example project patterns

5. Added Missing Imports
   - Added explicit imports in AgentConfig example
   - Makes examples more complete and copy-paste friendly

6. Improved Code Quality
   - Better variable naming (myChatModel, myEmbeddingModel)
   - More consistent formatting
   - Added helpful comments

These enhancements improve the documentation quality, make examples
more complete and usable, and align with Apache Camel documentation
standards and best practices.
@github-actions
Copy link
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟

🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run

  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot.

  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.

  • Build and test logs are available in the Summary page. Only Apache Camel committers have access to the summary.

  • ⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@gnodet gnodet changed the title Feature/camel 22850 Use LangChain4j Spring Boot starters in Camel Spring Boot Jan 19, 2026
Added Apache License headers to:
- pom.xml (XML format)
- application.yml (YAML format with ## comments)

This fixes the CI build failure where the build process
adds headers and then fails the uncommitted changes check.
The example Spring Boot project was causing CI build failures because
the license plugin was trying to add headers to files like README.md
and .gitignore which don't need them.

Full example projects should be in the separate camel-examples repository,
not in the main Camel repository's docs directory. The comprehensive
documentation in langchain4j-spring-boot-integration.adoc provides
sufficient code examples and configuration guidance for users.
@Croway
Copy link
Contributor

Croway commented Jan 20, 2026

Hi @gnodet thanks for looking into it, looking great, do you think there are improvements that can be done to https://github.com/apache/camel-spring-boot ? for example, maybe there are starters that can be used directly in camel-spring-boot instead of the springframeowrk dependency? (for autoconfiguration and such)

@gnodet
Copy link
Contributor Author

gnodet commented Jan 22, 2026

Hi @gnodet thanks for looking into it, looking great, do you think there are improvements that can be done to https://github.com/apache/camel-spring-boot ? for example, maybe there are starters that can be used directly in camel-spring-boot instead of the springframeowrk dependency? (for autoconfiguration and such)

Yes, things can probably be improved in camel-spring-boot. I'll have a look...

@gnodet gnodet marked this pull request as ready for review January 22, 2026 16:02
@gnodet gnodet changed the title Use LangChain4j Spring Boot starters in Camel Spring Boot CAMEL-22850 - Use LangChain4j Spring Boot starters in Camel Spring Boot Jan 22, 2026
@gnodet gnodet changed the title CAMEL-22850 - Use LangChain4j Spring Boot starters in Camel Spring Boot CAMEL-22850: Use LangChain4j Spring Boot starters in Camel Spring Boot Jan 22, 2026
@gnodet gnodet merged commit e65324f into apache:main Jan 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants