Important
This is a production-ready template project built with Spring Boot and microservice architecture. While it demonstrates industry best practices, please thoroughly review and enhance security measures before deploying to production.
A comprehensive Spring Boot-based e-commerce platform template with microservice architecture. This project provides a robust foundation for building scalable online shopping applications, incorporating industry-standard practices and modern technologies.
- 🏗️ Microservice Architecture - Built with Spring Cloud Alibaba
- 🔐 Security System - JWT and OAuth2 integration
- 📦 Data Management - JPA and MyBatis support
- 💾 Caching Solution - Redis integration
- 📨 Message Queue - RabbitMQ implementation
- 🔄 Gateway - Spring Cloud Gateway
- ⚙️ Service Discovery - Spring Cloud Eureka
- 🤖 AI Integration - Ready for AI feature development
- ⏰ Task Scheduling - Quartz implementation
- 📧 Email Service - Spring Mail support
- Prerequisites
- Project Creation Guide
- Project Structure
- Configuration
- Running the Application
- Common Issues
- Contributing
- License
Important
Before you begin, ensure you have the following installed:
- JDK 17 or later
- Maven 3.6+
- MySQL 5.7+
- IntelliJ IDEA (Recommended)
- Git
Create Project Using IntelliJ IDEA
- Open IntelliJ IDEA
- Click "New Project"
- Select "Spring Initializr"
- Configure project metadata:
Group: com.douyinmall Artifact: douyin-mall-java-template Name: douyin-mall-java-template Description: Douyin Mall Java Template Project Package name: com.douyinmall.mall Packaging: Jar Java version: 17
Select Dependencies
- Spring Web
- Spring Boot DevTools
- Lombok
- Spring Configuration Processor
- Spring Data JPA
- MySQL Driver
- Spring Data Redis
- MyBatis Framework
- Spring Security
- OAuth2 Resource Server
- Spring Session
- Spring for RabbitMQ
- Eureka Discovery Client
- Config Client
- Gateway
- Resilience4j
- Spring Boot Actuator
- Validation
- Java Mail Sender
- Quartz Scheduler
Create application.properties
in src/main/resources
:
# Application
spring.application.name=douyin-mall
server.port=8080
# Database
spring.datasource.url=jdbc:mysql://localhost:3306/douyin_mall?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=your_password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
# JPA
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.open-in-view=false
# Disable Services Initially
spring.autoconfigure.exclude=\
org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration,\
org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration,\
org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration
# Eureka Client
eureka.client.enabled=false
CREATE DATABASE douyin_mall CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
📦douyin-mall-java-template
┣ 📂src
┃ ┣ 📂main
┃ ┃ ┣ 📂java
┃ ┃ ┃ ┗ 📂com
┃ ┃ ┃ ┃ ┗ 📂douyinmall
┃ ┃ ┃ ┃ ┃ ┗ 📂mall
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜DouyinMallJavaTemplateApplication.java
┃ ┃ ┗ 📂resources
┃ ┃ ┃ ┣ 📂static
┃ ┃ ┃ ┣ 📂templates
┃ ┃ ┃ ┗ 📜application.properties
┃ ┗ 📂test
┃ ┃ ┗ 📂java
┃ ┃ ┃ ┗ 📂com
┃ ┃ ┃ ┃ ┗ 📂douyinmall
┃ ┃ ┃ ┃ ┃ ┗ 📂mall
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜DouyinMallJavaTemplateApplicationTests.java
┣ 📂target
┃ ┣ 📂classes
┃ ┃ ┣ 📂com
┃ ┃ ┃ ┗ 📂douyinmall
┃ ┃ ┃ ┃ ┗ 📂mall
┃ ┃ ┃ ┃ ┃ ┗ 📜DouyinMallJavaTemplateApplication.class
┃ ┃ ┗ 📜application.properties
┃ ┣ 📂generated-sources
┃ ┃ ┗ 📂annotations
┃ ┣ 📂generated-test-sources
┃ ┃ ┗ 📂test-annotations
┃ ┗ 📂test-classes
┃ ┃ ┗ 📂com
┃ ┃ ┃ ┗ 📂douyinmall
┃ ┃ ┃ ┃ ┗ 📂mall
┃ ┃ ┃ ┃ ┃ ┗ 📜DouyinMallJavaTemplateApplicationTests.class
┣ 📜.gitattributes
┣ 📜.gitignore
┣ 📜CODE_OF_CONDUCT.md
┣ 📜HELP.md
┣ 📜LICENSE
┣ 📜mvnw
┣ 📜mvnw.cmd
┣ 📜pom.xml
┗ 📜README.md
# Build the project
mvn clean package
# Run the application
java -jar target/douyin-mall-java-template-0.0.1-SNAPSHOT.jar
Run the main class DouyinMallApplication.java
directly in your IDE.
Tip
If you encounter JDK version issues:
- Verify JDK 17 installation
- Check project structure settings
- Confirm Maven compiler settings
Note
Common database connection issues:
- MySQL service status
- Database credentials
- Database existence
- Port availability
If port 8080 is occupied, modify server.port
in application.properties.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the Apache-2.0 License - see the LICENSE.md file for details.
Chan Meng
- LinkedIn: chanmeng666
- GitHub: ChanMeng666
⭐ Star us on GitHub | 📖 Read our Docs | 🐛 Report Issues