AOP

· Spring
1. 개요 Spring AOP(Aspect-Oriented Programming)를 활용하면, 권한 체크 로직을 모든 컨트롤러 메서드마다 반복해서 작성할 필요 없이 관점 지향 프로그래밍(Aspect-Oriented Programming) 방식으로 깔끔하게 분리할 수 있다.Spring AOP를 이용하여 API 호출 시 특정 역할(Role)만 접근 가능하도록 제한하는 방법을 정리하겠다. 2. 구현2 - 1. @RequireRole 어노테이션 생성 먼저, 권한 체크를 적용할 메서드에 사용할 커스텀 어노테이션을 생성한다.package com.example.infra.aspect;import java.lang.annotation.ElementType;import java.lang.annotation.Retenti..
Griotold
'AOP' 태그의 글 목록