반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 오프라인 소모임
- 정보처리기사 공부
- 정처기 공부
- 어피티 7월 북클럽
- 달개비
- 어피티 독자
- 수경재배
- 정보처리기사 합격
- springAOP
- 시나공
- 아보카도 키우기
- 개발 공부
- 정보처리기사
- 식물
- js
- AOP
- 자바
- 싱고니움
- Spring
- 식물키우기
- 아보카도키우기
- 아보카도
- 스프링AOP
- 스프링
- 북클럼
- 정보처리기사 실기
- 식물 키우기
- 삼색달개비
- 정처기 실기
- 정처기
Archives
- Today
- Total
deblog
AOP(Aspect Oriented Programming) 구현(2) 본문
반응형
2021.04.17 - [IT/Spring] - AOP(Aspect Oriented Programming)란?(1)
전 글에 이어진 내용입니다.
이번에는 스프링 AOP구현에 대해 적어보겠습니다.
구현과정
- 스프링 스프링 AOP를 사용하기 위한 의존을 추가한다.
- 공통 기능을 제공할 클래스를 구현한다.
- XML 설정 파일에 <aop:config>를 이용해서 Aspect를 설정한다. Advice를 어떤 Pointcut에 적용할지를 지정하게 된다.
XML 스키마 기반의 POJO클래스 AOP구현
Profile.java
public Object trace(ProceedingJoinPoint joinPoint)throws Throwable{
Object result = jointPoint.proceed();
}
acQuickStart.xml
<bean id="profiler" class="net.madvirus.aop.Profiler" />
<aop:config>
<aop:aspect id="traceAspect" ref="profiler">
<aop:pointcut id="publicMethod"
expression="execution(public * net.spring4.chap06..*(..))" />
<aop:around pointcut-ref="publicMethod" method="trace" />
@Aspect 애노테이션 기반 AOP퀵 스타트
ProfilingAspect.java
@Aspect
@Pointcut("execution(public * net.madvirus.board..*(..))")
private void profileTarget()
@Around("profileTarget()")
public Object trace(ProceedingJoinPoint joinPoint) throws Throwable{
joinPoint.getSignature().toShortString();
Object result = joinPoint.proceed();
acQuickStart.xml
<aop:aspectj-autoproxy />
<bean id="performanceTraceAspect"
class="net.madvirus.spring4.chap06.aop.ProfilingAspect" />
'IT > JAVA' 카테고리의 다른 글
heap과 stack의 차이점은? (0) | 2021.04.28 |
---|---|
오버라이딩과 오버로딩의 차이 (2) | 2021.04.28 |
AOP(Aspect Oriented Programming) 실습(3) (0) | 2021.04.17 |
AOP(Aspect Oriented Programming)란?(1) (0) | 2021.04.17 |
full-calendar라이브러리에 DB연동 (8) | 2021.03.30 |
Comments