feat(v1): unify API response, validation, exception handling and tests

This commit is contained in:
likingcode
2026-03-08 14:40:30 +00:00
parent 539dc41868
commit 6a4c6a369a
10 changed files with 216 additions and 73 deletions

View File

@@ -6,7 +6,6 @@ import com.example.demo.aop.RateLimited;
import com.example.demo.event.UserEventPublisher;
import com.example.demo.model.User;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
@@ -20,17 +19,20 @@ import java.util.Map;
@RequestMapping("/aop")
public class AopEventController {
@Autowired
private UserService userService;
private final UserService userService;
private final UserEventPublisher eventPublisher;
private final PerformanceAspect performanceAspect;
private final RateLimitAspect rateLimitAspect;
@Autowired
private UserEventPublisher eventPublisher;
@Autowired
private PerformanceAspect performanceAspect;
@Autowired
private RateLimitAspect rateLimitAspect;
public AopEventController(UserService userService,
UserEventPublisher eventPublisher,
PerformanceAspect performanceAspect,
RateLimitAspect rateLimitAspect) {
this.userService = userService;
this.eventPublisher = eventPublisher;
this.performanceAspect = performanceAspect;
this.rateLimitAspect = rateLimitAspect;
}
/**
* 学习首页