티스토리 뷰

QR인식 or 이미지 클릭하여 회원가입시(평생 수수료 25%이상 할인)-[25% or more discount on commission]

 

아래 링크를 통해 가입시 바이낸스 코인 거래수수료 25% 평생할인!

25% lifetime discount on Binance Coin transaction fees when you sign up through the link below!

https://accounts.binance.com/en/register?ref=286562663

 

Log In | Binance

login-description

accounts.binance.com

 

바이낸스 추천코드로 가입하고 수수료 25% 평생 할인 받으세요! (바이낸스 가입 레퍼럴코드, 추천

바이낸스 추천코드로 가입하고 수수료 25% 평생 할인 받으세요! 바이낸스 가입코드, 레퍼럴코드, 추천코드, 할인코드  :  ( 286562663 ) 아래 링크를 통해 가입시 25% 할인 받을 수 있습니다 http

pink24.tistory.com

 

 

Spring AOP 4-3 Schema 기반의 AOP 설정

 

AOP 네임스페이스 설정

<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-3.0.xsd

              http://www.springframework.org/schema/aop

              http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

</beans>

 

<beans /> 루트 엘리먼트에 AOP 관련 네임스페이스 추가

 

 

 

AOP 관련 엘리먼트

<aop:config />

AOP관련 엘리먼트 중 최상위 엘리먼트

<beans /> 내에 여러 번 반복될 수 있음.

내부에 <aop:pointcut />, <aop:aspect /> 등이 위치할 수 있음.

<aop:pointcut />

포인트컷 지정, ID를 식별자로 사용하여 참조될 수 있음

com.multicampus.biz.user 패키지의 UserService 인터페이스의 모든 메소드 호출시점의 Pointcut testPointcut 이라는 이름으로 등록

 

<beans xmlns="http://www.springframework.org/schema/beans" >

  <bean id="logAdvice" class="com.multicampus.biz.common.LoggingAdvice">

  <aop:config>

    <aop:pointcut id="testPointcut"

        expression=" execution(* com.multicampus.biz.user.UserService.*(..))"/>

    <aop:aspect id="logAspect" ref="logAdvice">

       <aop:before pointcut-ref="testPointcut" method="log"/>

    </aop:aspect>

  </aop:config>

</beans>

 

 

 

<aop:aspect />

pointcut aspect가 결합된 개념으로 AOP에서 가장 중요한 핵심 개념임

Advice 클래스가 bean으로 설정되어 있어야 함.

<beans xmlns="http://www.springframework.org/schema/beans" >

  <bean id="logAdvice" class="com.multicampus.biz.common.LoggingAdvice">

  <aop:config>

    <aop:pointcut id="testPointcut"

        expression=" execution(* com.multicampus.biz.user.UserService.*(..))"/>

    <aop:aspect id="logAspect" ref="logAdvice">

       <aop:before pointcut-ref="testPointcut" method="log"/>

    </aop:aspect>

  </aop:config>

</beans>

<aop:advisor />

직접 어드바이스를 포인트컷과 연결할 목적으로 사용함.

트랜잭션 처리시에 주로 사용

 

 

 

 

어드바이스 설정

before 어드바이스 : 메서드 실행 전에 처리할 내용을 기술하기 위해 사용

<beans xmlns="http://www.springframework.org/schema/beans" >

  <bean id="logAdvice" class="com.multicampus.biz.common.LoggingAdvice">

  <aop:config>

    <aop:pointcut id="testPointcut"

        expression=" execution(* com.multicampus.biz.user.UserService.*(..))"/>

    <aop:aspect id="logAspect" ref="logAdvice">

       <aop:before pointcut-ref="testPointcut" method="log"/>

    </aop:aspect>

  </aop:config>

</beans>

 

after 어드바이스

after returning : 성공적으로 리턴한 후에 처리할 내용 기술

after  throwing : 메서드라 예외를 발생시킨 후에 처리할 내용 기술

after : 예외가 발생하든 발생하지 않든 무조건 실행시킴.

 

 

 

After returning

<aop:after-returning /> 태그 사용

호출되는 어드바이스 메서드는 object 인자 사용 -> 리턴값 확인

<aop:aspect id="logAspect" ref="logAdvice">

   <aop:after-returning pointcut-ref="testPointcut" method="afterLog"/>

</aop:aspect>

public class LoggingAdvice {

    public void afterLog(Object returnVal){

        System.out.println("Return 된 객체의 값 : " + returnVal);

    }

}

After Throwing

<aop:after-throwing />

호출되는 어드바이스 메서드는 Exception 인자 사용 -> 예외 정보 확인

 

After

<aop:after />

try~catch~finally 에서  finally의 의미처럼 사용

Around

메서드 호출 전, 후 모두 실행

Servlet 필터와 유사한 개념

<aop:around /> 사용

원래의 비즈니스 객체의 메서드를 호출해주어야 함. -> 이를 위해 ProceedingJoinPoint 객체를 인자로 사용함.

public class FilterAdvice {

    public Object filter(ProceedingJoinPoint process){

        System.out.println("[BEFORE]: 비즈니스 메소드 수행 전에 처리될 내용...");

        //비즈니스 객체의 메서드 호출

        Object returnVal = process.proceed();      

        System.out.println("[AFTER]: 비즈니스 메소드 수행 후에 처리될 내용...");

        return returnVal;

    }

}

 

 

 

Advice 매개변수

Advice 객체의 메서드에서 비즈니스 객체의 메서드 호출에 관한 정보를 획득하고자 한다면 JoinPoint 객체를 인자로 전달받으면 됨.

JoinPoint 매개변수는 다른 인자보다 앞에 위치해야 함.

JoinPoint 객체의 메서드

 

메소드명 설명
Signature getSignature() 호출되는 메소드 시그니쳐에 대한 정보를 제공하는 Signature 객체를 리턴한다.
Object getTarget() 호출하는 대상 객체를 리턴한다.
Object[] getArgs() 호출시 메소드의 매개변수를 Object 배열 객체로 리턴한다.

 

 

 

 

 

Signature객체의 메서드

메소드명 설명
String getName() 호출된 비즈니스 메소드 이름이 리턴 된다.
String toLongString() 메소드를 완전하게 표현한 문장으로 리턴 된다.
메소드의 리턴 타입, 파라미터 타입 등이 모두 표현된다.
String toShortString() 메소드 시그니쳐를 축약한 문자열로 리턴한다.

 

Advice 매개변수 - 이어서

JoinPoint 사용 예

public class ExceptAdvice {

   public void exceptHandle(JoinPoint jp, Exception exceptObj){

      Signature method = jp.getSignature();

      String method = method.getName();

      System.out.println(method + "() 메소드에서 예외 발생 : " +

         exceptObj.getMessage());

      Object[] args = jp.getArgs();

      for(int i=0; i<args.length; i++){

          System.out.println("매개변수(" + i + ") : " + args[i]);

      }

   }

}

 

 

"이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다."

바이낸스 코인 거래수수료 25% 평생할인받기

 

바이낸스 추천코드로 가입하고 수수료 25% 평생 할인 받으세요! (바이낸스 가입 레퍼럴코드, 추천

바이낸스 추천코드로 가입하고 수수료 25% 평생 할인 받으세요! 바이낸스 가입코드, 레퍼럴코드, 추천코드, 할인코드  :  ( 286562663 ) 아래 링크를 통해 가입시 25% 할인 받을 수 있습니다 http

pink24.tistory.com

 

비트코인 바이낸스 거래소 선물거래, 마진거래방법 가이드 - 바이낸스 회원가입(계정생성)

 

비트코인 바이낸스 선물거래, 마진거래 방법 feat.바이낸스 회원가입

바이낸스 거래소 선물 및 마진거래 방법! ------------------------------------------------------------------------ 1. 바이낸스 회원가입 2. 국내코인거래소에서 코인을 구매 후 바이낸스 지갑으로 전송. 3...

pink24.tistory.com

 

비트코인 바이낸스 마진거래방법, 선물거래방법 - USDT

 

바이낸스 선물, 마진거래 방법 (USDT)

Usdt 거래에 필요한 기존 단계들은 아래 링크드린 이전 포스팅을 참고해주세요 https://pink24.tistory.com/9 비트코인 바이낸스 선물거래, 마진거래 방법 feat.바이낸스 회원가입 바이낸스 거래소 선물

pink24.tistory.com

댓글

QR인식 or 이미지 클릭하여 회원가입시(평생 수수료 20%이상 할인)-[20% or more discount on commission]

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
글 보관함