Spring Boot backend service for the YUJU Employee Benefits E-commerce System.
- Framework: Spring Boot 3.2.0
- Language: Java 17
- Database: MySQL 8.0
- Cache: Redis
- ORM: MyBatis Plus
- Security: Spring Security + JWT
- Build Tool: Maven
backend/
├── src/
│ ├── main/
│ │ ├── java/com/yuju/benefits/
│ │ │ ├── controller/ # REST API endpoints
│ │ │ ├── service/ # Business logic
│ │ │ ├── repository/ # Data access (MyBatis Mappers)
│ │ │ ├── entity/ # Database entities
│ │ │ ├── dto/ # Data Transfer Objects
│ │ │ ├── config/ # Configuration classes
│ │ │ ├── exception/ # Custom exceptions
│ │ │ └── util/ # Utility classes
│ │ └── resources/
│ │ ├── application.yml # Main configuration
│ │ ├── application-dev.yml
│ │ ├── application-test.yml
│ │ ├── application-prod.yml
│ │ └── mapper/ # MyBatis XML mappers
│ └── test/ # Test classes
└── pom.xml # Maven dependencies
- Java 17 or higher
- Maven 3.6+
- MySQL 8.0+
- Redis 6.0+
-
Create Database
CREATE DATABASE yuju_benefits CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-
Configure Database Connection
Edit
src/main/resources/application-dev.yml:spring: datasource: url: jdbc:mysql://localhost:3306/yuju_benefits username: your_username password: your_password
-
Configure Redis
Edit
src/main/resources/application-dev.yml:spring: data: redis: host: localhost port: 6379 password: your_password # Leave empty if no password
-
Build Project
mvn clean install
-
Run Application
mvn spring-boot:run
The application will start on
http://localhost:8080/api
Once the application is running, API documentation will be available at:
- Swagger UI:
http://localhost:8080/api/swagger-ui.html(to be configured in task 1.2)
Run all tests:
mvn testRun property-based tests:
mvn test -Dtest=**/*PropertyTestKey configuration properties in application.yml:
- JWT Settings: Token expiration, secret key
- Security: Password encoder strength, login attempts
- Inventory: Low stock threshold
- Cart: Item expiry, reservation timeout
- Points: Monthly grant amount and schedule
Active profile is set to dev by default. Change it in application.yml:
spring:
profiles:
active: dev # dev, test, or prodInternal use only - YUJU Corporation