This file provides guidance to Codex (Codex.ai/code) when working with code in this repository.
# Set JDK 21 (required โ record syntax, virtual threads)
export JAVA_HOME="D:\Develop\DevelopTool\StudyEnvironment\PhpWebStudy-Data\app\openjdk-21.0.9"
# Compile
cd Argus-backend && ./mvnw clean compile
# Run tests
./mvnw test
# Run single test
./mvnw test -Dtest=ClassName#methodName
# Package
./mvnw clean package -DskipTests
# Run app (local profile by default)
./mvnw spring-boot:run- Java 21 with Spring Boot 3.5.0, Spring MVC (no WebFlux)
- MyBatis-Plus 3.5.15 (not JdbcTemplate) for all DB access
- PostgreSQL as the database (driver already in pom)
- Maven with wrapper (
mvnw) - Lombok 1.18.34 (available but currently unused โ entity getters/setters are hand-written)
- JJWT 0.12.6 for JWT access tokens
- Spring Security Crypto (BCrypt) for password hashing
- Knife4j 4.5.0 for API documentation
com.argus.rag
โโโ ArgusBackendApplication # @SpringBootApplication entry point
โโโ common/ # Shared infrastructure
โ โโโ api/ApiResponse # Unified response record: {success, data, message}
โ โโโ enums/ # SystemRole, UserStatus, GroupRole, etc.
โ โโโ exception/ # BusinessException(400), ForbiddenException(403),
โ # UnauthorizedException(401), GlobalExceptionHandler
โโโ auth/ # Authentication & authorization
โ โโโ config/ # AuthProperties (@ConfigurationProperties prefix: argus.rag.auth),
โ โ # AuthConfiguration (PasswordHasher bean, Clock bean),
โ โ # DevAdminInitializer (@Profile("dev") seeds admin account)
โ โโโ controller/AuthController # /api/auth/{login,register,refresh,logout,me}
โ โโโ service/ # AuthService (login/register/refresh logic),
โ โ # PasswordHasher interface, RefreshTokenRecord
โ โโโ security/ # JwtAuthenticationFilter (OncePerRequestFilter),
โ โ # JwtAccessTokenService (issue/parse JWT),
โ โ # RefreshTokenService (refresh token CRUD),
โ โ # AuthCookieSupport (refresh token cookie)
โ โโโ model/entity/UserRefreshToken # MyBatis-Plus entity โ user_refresh_tokens table
โ โโโ mapper/UserRefreshTokenMapper # MyBatis-Plus BaseMapper
โ โโโ CurrentUserService # Extracts authenticated user from request attribute
โโโ user/ # User management
โโโ controller/ # AccountController (/api/account/change-password),
โ # AdminUserController (/api/admin/users CRUD)
โโโ service/ # AccountService, AdminUserService, UserQueryService
โโโ model/entity/User # MyBatis-Plus entity โ users table
โโโ model/dto/ # Request records (ChangePassword, UpdateUserStatus, etc.)
โโโ model/vo/ # Response records (AdminUserItemResponse)
โโโ mapper/UserMapper # MyBatis-Plus BaseMapper + custom XML methods
- All DB access uses
BaseMapper+LambdaQueryWrapper, neverJdbcTemplate - Entities extend nothing but use
@TableName/@TableId(type = IdType.AUTO) - Complex queries with
FOR UPDATErow locking go insrc/main/resources/mappers/*.xml - Enums use
default-enum-type-handler: org.apache.ibatis.type.EnumTypeHandler(stored asname()strings)
- Every controller method returns
ApiResponse<T>โ arecordwithsuccess(),data(),message() - Never throw raw exceptions; throw
BusinessException/ForbiddenException/UnauthorizedExceptionwhichGlobalExceptionHandlermaps to HTTP status codes
JwtAuthenticationFilterextracts Bearer token โ setsAuthenticatedUseras request attributeCurrentUserServicereads that attribute to provideCurrentUserrecord- Controllers call
currentUserService.getRequiredCurrentUser(request)orrequireSystemAdmin(request) - Refresh tokens stored in
user_refresh_tokenstable, sent as httpOnly cookie
- Active profile:
local(default inapplication.yml) - Auth properties prefix:
argus.rag.auth(maps toAuthPropertiesclass) - MyBatis-Plus XML mappers:
classpath*:/mappers/**/*.xml - Enum handling: Stored as VARCHAR using enum
.name()values