A Powerful Three‑Tier Travel App Powered by AI, LangChain4j, and Collaborative Filtering
This article introduces a three‑endpoint travel system (mini‑program, web front‑end, and back‑end) that integrates Java Spring Boot, Vue 3, LangChain4j, DeepSeek, Ollama embeddings, and Mahout‑based collaborative filtering to provide AI‑driven recommendations and a RAG‑enhanced chat assistant.
The author presents a complete three‑tier travel application—comprising a WeChat mini‑program, a Vue 3 web front‑end, and a Spring Boot back‑end—along with extensive source code, documentation, and video tutorials.
Project screenshots illustrate the UI and workflow:
Technology Stack
Back‑end (travel‑api) uses Java 21, Spring Boot 3.2.2, MyBatis‑Plus 3.5.15, MySQL Connector/J 8.0.33, Spring Security 6.x, jjwt 0.11.5, Apache Mahout 0.13.0, LangChain4j 1.8.0‑beta15, Spring WebFlux, Spring Data Redis, Lombok 1.18.30, and Maven.
Front‑end (travel‑vue‑front) is built with Vue 3 (Composition API), Vite, Vue Router, Pinia, Element Plus, Axios, and ECharts.
Documentation
Detailed documentation and video tutorials are provided to help readers quickly understand the project architecture and codebase.
Core Recommendation Engine (Collaborative Filtering)
The recommendation service implements a Mahout‑based user‑behavior collaborative filtering pipeline:
Retrieve all user favorite records via scenicFavoriteMapper.selectList(null).
Build a FastByIDMap<PreferenceArray> mapping each user to a list of liked scenic spots (preference value 1.0f).
Create a GenericDataModel from the user data.
Compute user similarity with LogLikelihoodSimilarity, suitable for boolean preferences.
Find the nearest 5 neighbors using NearestNUserNeighborhood(5, similarity, model).
Generate recommendations via GenericUserBasedRecommender and recommender.recommend(userId, limit * 2).
Map the results to ScenicSpot objects, sort by recommendation order, and limit the output.
If the result is empty or an error occurs, fall back to getPopularRecommendations(limit).
DataModel model = new GenericDataModel(userData);
UserSimilarity similarity = new LogLikelihoodSimilarity(model);
UserNeighborhood neighborhood = new NearestNUserNeighborhood(5, similarity, model);
Recommender recommender = new GenericUserBasedRecommender(model, neighborhood, similarity);
List<RecommendedItem> recommendations = recommender.recommend(userId, limit * 2);The service interface defines four recommendation methods:
public interface IRecommendationService {
List<ScenicSpot> recommendBasedOnUserBehavior(Long userId, int limit);
List<ScenicSpot> recommendBasedOnContent(Long scenicSpotId, int limit);
List<ScenicSpot> recommendBasedOnCollaborativeFiltering(Long userId, int limit);
List<ScenicSpot> getPopularRecommendations(int limit);
}AI Assistant (RAG‑Enabled Chat)
The AI features are built with LangChain4j 1.8.0, using DeepSeek‑v4‑flash as the large language model (via OpenAI‑compatible adapter), Ollama‑deployed BGE‑M3 embeddings, and Redis for conversation memory. The pipeline consists of an InMemoryEmbeddingStore (switchable to Redis) for vector storage, an IngestionService plus buildRagPrompt for knowledge‑base indexing, and a conditional bean @ConditionalOnProperty(ai.rag.enabled) that enables or disables RAG with a single switch.
Server and Streaming
The MCP server runs on port 8081 using streamable‑http to expose external tool integrations. Responses are streamed to the client with Spring WebFlux Flux<String>, providing real‑time chat output.
Overall, the article offers a hands‑on, end‑to‑end example of combining modern Java back‑end frameworks, Vue front‑end tooling, collaborative filtering, and LLM‑powered RAG to build a feature‑rich travel recommendation system.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
SpringMeng
Focused on software development, sharing source code and tutorials for various systems.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
