JavaClaw AI Agent测试最佳实践完整指南:Testcontainers + ArchUnit模块边界 + 假上游集成测试
2026/10/30 9:46:31
上一篇我们讲了 RBAC 与 Spring Security 的概念,
这一篇真正动手:用最少的代码,搭一个能挡人的权限系统。
目标只有一句话:
登录能识别人,接口能拦权限。
依赖(Spring Boot 项目):
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt-api</artifactId> <version>0.11.5</version> </dependency>只要 5 张表:
权限表示例数据:
| id | code |
|---|---|
| 1 | order:read |
| 2 | order:refund |