Skip to content
@RestController
@RequestMapping
@GetMapping
@PostMapping
@PutMapping
@DeleteMapping
@PathVariable
@RequestBody
@Service
@Repository
@Component
@Configuration
@Entity
@Table
@Id
@GeneratedValue
@Column
@Valid: สั่งให้ตรวจ DTO ตาม validation annotation
@NotBlank: ห้ามเป็น null และห้ามเป็น string ว่าง
@Email: ต้องอยู่ในรูปแบบ email
@Size: กำหนดความยาว string หรือจำนวน element
@PreAuthorize: ตรวจสิทธิ์ก่อนเข้า method
@AuthenticationPrincipal: ดึง principal ปัจจุบันจาก security context
@Transactional: กำหนดขอบเขต transaction ของ database operation
@RestControllerAdvice: สร้าง global exception handler สำหรับ REST API
@ExceptionHandler: map exception กับ method ที่ใช้จัดการ error