Spring AOP 4

[Spring] 12 -3 AOP 적용하기 (Component + 심화)

이번에는 component-scan을 이용해서 AOP를 적용해보도록 하겠습니다. 바로 패키지 만들러 가볼까요 ~ Student.java (interface) package com.test06; public interface Student { void classWork(); } StudentA.java package com.test06; public class StudentA implements Student { @Override public void classWork() { System.out.println("컴퓨터를 켜서 뉴스를 본다."); } } StudentB.java package com.test06; public class StudentB implements Student { @Override ..

Java/Spring 2021.07.06

[Spring] 12 -2 AOP 적용하기 ( Annotation - Before, After, AfterReturning, AfterThrowing)

이번엔 annotation을 사용하여 aop를 적용해보도록 하겠습니다. com.test04 패키지 만들어주세요 Student.java (interface) package com.test04; public interface Student { public String classWork(); } StudentA.java package com.test04; public class StudentA implements Student { @Override public String classWork() { System.out.println("컴퓨터를 켜서 뉴스를 본다."); return "스프링 연습"; } } StudentB.java package com.test04; public class StudentB impl..

Java/Spring 2021.07.05

[Spring] 12 -1 AOP 적용하기 ( Namespace - aop)

저번 포스팅에 이어서 이번에는 AOP를 적용하는 방법중에 namespace를 이용하는 방법을 사용해보겠습니다. 바로 패키지 만들러 가볼까요~ Student.java(interface) package com.test03; public interface Student { void classWork(); } StudentA.java package com.test03; public class StudentA implements Student { @Override public void classWork() { System.out.println("컴퓨터를 켜서 뉴스를 본다."); } } StudentB.java package com.test03; public class StudentB implements Stude..

Java/Spring 2021.07.04

[Spring] 12. AOP - 기본 개념 ( CC, CCC, Joinpoint, ...)

오늘은 스프링의 AOP에 대해서 공부해보겠습니다. AOP ( Aspect Oriented Programing) - 관점지향 프로그래밍이라고 합니다. AOP에 사용되는 용어들을 간단히 정리해보자면 CC (Core Concern) : 주 관심사항 CCC (Cross Cutting Concern) : 공통 관심사항 Joinpoint : 인스턴스의 생성시점과 메소드를 실행하는 시점, Exception이 발생하는 시점같이 애플리케이션이 실행될 때 특정 작업이 실행되는 시점 Pointcut : 어떠한 Joinpoint에 적용되어야 하는지 정의 Advice : Pointcut에서 지정한 Joinpoint에서 실행(삽입) 되어야 하는 코드로 Aspect의 실제 구현체 Aspect : Advice + pointcut 으..

Java/Spring 2021.07.03