Open yidasom opened 2 years ago
spring 시작 시, 설정해 놓은 xml 파일에 아래의 코드를 등록한다. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd">
spring 시작 시, 설정해 놓은 xml 파일에 아래의 코드를 등록한다.
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd">
> 클래스 제일 상단에 @Aspect를 기재해준 뒤에 후에 작성할 코드 위에 상황에 맞게 작성 > 아래는 Advice종류
@Before("execution(public springframework.com..impl.Impl.selectArticleDetail*(..))")
@After("execution(public springframework.com..impl.Impl.selectArticleDetail*(..))")
@AfterReturning(pointcut = "execution(public springframework.com..impl.Impl.selectArticleDetail*(..))", returning = "obj")
@AfterThrowing(pointcut = "execution(public springframework.com..impl.Impl.selectArticleDetail*(..))", throwing = "exception")
@Around("execution(public springframework.com..impl.Impl.selectArticleDetail*(..))")
참고 https://yo-hana.tistory.com/12
Spring
maven (설정)
@Before("execution(public springframework.com..impl.Impl.selectArticleDetail*(..))")
@After("execution(public springframework.com..impl.Impl.selectArticleDetail*(..))")
@AfterReturning(pointcut = "execution(public springframework.com..impl.Impl.selectArticleDetail*(..))", returning = "obj")
@AfterThrowing(pointcut = "execution(public springframework.com..impl.Impl.selectArticleDetail*(..))", throwing = "exception")
@Around("execution(public springframework.com..impl.Impl.selectArticleDetail*(..))")