A RESTful article management system built with Spring Boot, featuring user authentication, article publishing, and cloud file storage.
- User Management: Registration, login, profile updates
- Article Management: Create, read, update, delete articles with pagination
- Category Management: Organize articles by categories
- File Upload: Integration with Tencent Cloud Object Storage (COS)
- Security: JWT-based authentication with Redis token management
- Data Validation: Custom validation annotations and Bean Validation
- Backend: Spring Boot 3.4.4, Spring MVC
- Database: MySQL with MyBatis ORM
- Authentication: JWT + Redis
- Cloud Storage: Tencent Cloud COS
- Build Tool: Maven
- Java Version: 17
- Spring Boot Starter Web
- Spring Boot Starter Data Redis
- Spring Boot Starter Validation
- MyBatis Spring Boot Starter
- MySQL Connector
- JWT (java-jwt)
- PageHelper (pagination)
- Tencent COS SDK
- Lombok
- Java 17+
- MySQL 8.0+
- Redis
- Maven 3.6+
-
Clone the repository
git clone https://github.com/Neuro987/big-event-backend.git cd big-event -
Configure the database
- Create a MySQL database named
big_event - Update database credentials in
src/main/resources/application.yml
- Create a MySQL database named
-
Configure Redis
- Ensure Redis is running on localhost:6379
- Update Redis configuration in
application.ymlif needed
-
Configure Tencent COS (Optional)
- Update COS credentials in
application.ymlfor file upload functionality
- Update COS credentials in
-
Run the application
./mvnw spring-boot:run
Or on Windows:
mvnw.cmd spring-boot:run
The application will start on http://localhost:8080
POST /user/register- User registrationPOST /user/login- User loginGET /user/userInfo- Get user informationPUT /user/update- Update user profilePATCH /user/updateAvatar- Update user avatarPATCH /user/updatePwd- Update password
POST /article- Create articleGET /article- Get articles with paginationPUT /article- Update articleGET /article/detail- Get article detailsDELETE /article- Delete article
POST /category- Create categoryGET /category- Get all categoriesGET /category/detail- Get category detailsPUT /category- Update categoryDELETE /category- Delete category
POST /upload- Upload file to cloud storage
The API uses JWT tokens for authentication. Include the token in the Authorization header:
Authorization: <your-jwt-token>
Tokens are stored in Redis and have a 24-hour expiration time.
src/main/java/com/learn/bigevent/
├── controller/ # REST controllers
├── service/ # Business logic layer
├── mapper/ # MyBatis mappers
├── pojo/ # Entity classes
├── utils/ # Utility classes
├── config/ # Configuration classes
├── interceptors/ # Request interceptors
├── exception/ # Exception handlers
├── validation/ # Custom validators
└── anno/ # Custom annotations
Run the test suite:
./mvnw testTest classes include:
- JWT functionality tests
- Redis integration tests
- Thread safety tests
Key configuration properties in application.yml:
spring:
datasource:
url: jdbc:mysql://localhost:3306/big_event
username: your_username
password: your_password
data:
redis:
host: localhost
port: 6379
tencent.cos:
secret-id: your_secret_id
secret-key: your_secret_key
bucket-name: your_bucket_name
region: your_region