AspectServiceBean 추가

master
mjkhan21 9 months ago
parent 16e682896b
commit a1c3594106

@ -0,0 +1,87 @@
package cokr.xit.foundation.component;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
/**Aspect ServiceBean.
* <p> .
* <ul><li> - <code>execution(* cokr.xit..service.bean.*ServiceBean.*(..))</code></li>
* <li> - <code>execution(* cokr.xit..*Controller.*(..))</code></li>
* </ul>
* @author mjkhan
*/
@Aspect
public abstract class AspectServiceBean extends AbstractServiceBean {
private static final String
SVC_POINT = "execution(* cokr.xit..service.bean.*ServiceBean.*(..))",
CNTR_POINT = "execution(* cokr.xit..*Controller.*(..))";
/** .
* @param joinPoint JoinPoint
*/
@Before(CNTR_POINT)
public void beforeController(JoinPoint joinPoint) {}
/** .
* @param joinPoint JoinPoint
*/
@Before(SVC_POINT)
public void beforeService(JoinPoint joinPoint) {}
/** .
* @param joinPoint JoinPoint
* @param returned
*/
@AfterReturning(value = SVC_POINT, returning = "returned")
public void afterServiceReturn(JoinPoint joinPoint, Object returned) {}
/** .
* @param joinPoint JoinPoint
* @param thrown
*/
@AfterThrowing(value = SVC_POINT, throwing = "thrown")
public void afterServiceThrow(JoinPoint joinPoint, Throwable thrown) {}
/** / .
* @param joinPoint JoinPoint
*/
@After(SVC_POINT)
public void afterService(JoinPoint joinPoint) {}
/** .
* @param joinPoint JoinPoint
* @param returned
*/
@AfterReturning(value = CNTR_POINT, returning = "returned")
public void afterControllerReturn(JoinPoint joinPoint, Object returned) {}
/** .
* @param joinPoint JoinPoint
* @param thrown
*/
@AfterThrowing(value = CNTR_POINT, throwing = "thrown")
public void afterControllerThrow(JoinPoint joinPoint, Throwable thrown) {}
/** / .
* @param joinPoint JoinPoint
*/
@After(CNTR_POINT)
public void afterController(JoinPoint joinPoint) {}
/** .
* @param str
* @param joinPoint JoinPoint
*/
protected void log(String str, JoinPoint joinPoint) {
log().debug(
"{}({}): {}",
str,
Thread.currentThread().getId(),
joinPoint.getTarget().getClass().getName() + "#" + joinPoint.getSignature().getName()
);
}
}
Loading…
Cancel
Save