BAEL-19967: Migrate spring-aop module to the com.baeldung package
This commit is contained in:
parent
9cd4a0a16e
commit
c56b1558cb
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung;
|
||||
package com.baeldung;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung;
|
||||
package com.baeldung;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
|
@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
|
|||
@Component
|
||||
public class ExampleAspect {
|
||||
|
||||
@Around("@annotation(LogExecutionTime)")
|
||||
@Around("@annotation(com.baeldung.LogExecutionTime)")
|
||||
public Object logExecutionTime(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung;
|
||||
package com.baeldung;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung;
|
||||
package com.baeldung;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.aspectj;
|
||||
package com.baeldung.aspectj;
|
||||
|
||||
public class Account {
|
||||
int balance = 20;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.aspectj;
|
||||
package com.baeldung.aspectj;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -8,7 +8,7 @@ public aspect AccountAspect {
|
|||
final int MIN_BALANCE = 10;
|
||||
|
||||
pointcut callWithDraw(int amount, Account account):
|
||||
call(boolean Account.withdraw(int)) && args(amount) && target(account);
|
||||
call(boolean com.baeldung.aspectj.Account.withdraw(int)) && args(amount) && target(account);
|
||||
|
||||
before(int amount, Account account) : callWithDraw(amount, account) {
|
||||
logger.info(" Balance before withdrawal: {}", account.balance);
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.aspectj;
|
||||
package com.baeldung.aspectj;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.aspectj;
|
||||
package com.baeldung.aspectj;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.aspectj;
|
||||
package com.baeldung.aspectj;
|
||||
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
|
@ -1,13 +1,13 @@
|
|||
package org.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAfterAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void afterAdvice() throws Throwable {
|
||||
logger.info("I'm done calling the method");
|
||||
}
|
||||
}
|
||||
package com.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAfterAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void afterAdvice() throws Throwable {
|
||||
logger.info("I'm done calling the method");
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
package org.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAfterReturnAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void afterReturn(final Object returnValue) throws Throwable {
|
||||
logger.info("value return was {}", returnValue);
|
||||
}
|
||||
}
|
||||
package com.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAfterReturnAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void afterReturn(final Object returnValue) throws Throwable {
|
||||
logger.info("value return was {}", returnValue);
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
package org.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAfterThrowAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void afterThrow(final Exception exception) throws Throwable {
|
||||
logger.info("Exception thrown was {}", exception.getMessage());
|
||||
}
|
||||
}
|
||||
package com.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAfterThrowAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void afterThrow(final Exception exception) throws Throwable {
|
||||
logger.info("Exception thrown was {}", exception.getMessage());
|
||||
}
|
||||
}
|
|
@ -1,18 +1,18 @@
|
|||
package org.baeldung.logger;
|
||||
|
||||
import java.util.Arrays;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAroundAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public Object aroundAdvice(final ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
logger.info("Arguments passed to method are: " + Arrays.toString(joinPoint.getArgs()));
|
||||
final Object result = joinPoint.proceed();
|
||||
logger.info("Result from method is: " + result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
package com.baeldung.logger;
|
||||
|
||||
import java.util.Arrays;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderAroundAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public Object aroundAdvice(final ProceedingJoinPoint joinPoint) throws Throwable {
|
||||
logger.info("Arguments passed to method are: " + Arrays.toString(joinPoint.getArgs()));
|
||||
final Object result = joinPoint.proceed();
|
||||
logger.info("Result from method is: " + result);
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
package org.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderBeforeAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void beforeAdvice() throws Throwable {
|
||||
logger.info("I would be executed just before method starts");
|
||||
}
|
||||
}
|
||||
package com.baeldung.logger;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class AdderBeforeAspect {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
public void beforeAdvice() throws Throwable {
|
||||
logger.info("I would be executed just before method starts");
|
||||
}
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
package org.baeldung.logger;
|
||||
|
||||
public class SampleAdder {
|
||||
|
||||
public int add(int a, int b) {
|
||||
if (a < 0 || b < 0) {
|
||||
throw new IllegalArgumentException("Make sure all the arguments are greater than zero.");
|
||||
}
|
||||
return a + b;
|
||||
}
|
||||
|
||||
}
|
||||
package com.baeldung.logger;
|
||||
|
||||
public class SampleAdder {
|
||||
|
||||
public int add(int a, int b) {
|
||||
if (a < 0 || b < 0) {
|
||||
throw new IllegalArgumentException("Make sure all the arguments are greater than zero.");
|
||||
}
|
||||
return a + b;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.performancemonitor;
|
||||
package com.baeldung.performancemonitor;
|
||||
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.aop.Advisor;
|
||||
|
@ -16,10 +16,10 @@ import java.time.Month;
|
|||
@EnableAspectJAutoProxy
|
||||
public class AopConfiguration {
|
||||
|
||||
@Pointcut("execution(public String org.baeldung.performancemonitor.PersonService.getFullName(..))")
|
||||
@Pointcut("execution(public String com.baeldung.performancemonitor.PersonService.getFullName(..))")
|
||||
public void monitor() { }
|
||||
|
||||
@Pointcut("execution(public int org.baeldung.performancemonitor.PersonService.getAge(..))")
|
||||
@Pointcut("execution(public int com.baeldung.performancemonitor.PersonService.getAge(..))")
|
||||
public void myMonitor() { }
|
||||
|
||||
@Bean
|
||||
|
@ -30,7 +30,7 @@ public class AopConfiguration {
|
|||
@Bean
|
||||
public Advisor performanceMonitorAdvisor() {
|
||||
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
|
||||
pointcut.setExpression("org.baeldung.performancemonitor.AopConfiguration.monitor()");
|
||||
pointcut.setExpression("com.baeldung.performancemonitor.AopConfiguration.monitor()");
|
||||
return new DefaultPointcutAdvisor(pointcut, performanceMonitorInterceptor());
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class AopConfiguration {
|
|||
@Bean
|
||||
public Advisor myPerformanceMonitorAdvisor() {
|
||||
AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
|
||||
pointcut.setExpression("org.baeldung.performancemonitor.AopConfiguration.myMonitor()");
|
||||
pointcut.setExpression("com.baeldung.performancemonitor.AopConfiguration.myMonitor()");
|
||||
return new DefaultPointcutAdvisor(pointcut, myPerformanceMonitorInterceptor());
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.performancemonitor;
|
||||
package com.baeldung.performancemonitor;
|
||||
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.apache.commons.logging.Log;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.performancemonitor;
|
||||
package com.baeldung.performancemonitor;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.performancemonitor;
|
||||
package com.baeldung.performancemonitor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.performancemonitor;
|
||||
package com.baeldung.performancemonitor;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
|
@ -1,6 +1,6 @@
|
|||
<aspectj>
|
||||
<aspects>
|
||||
<aspect name="org.baeldung.aspectj.SecuredMethodAspect"/>
|
||||
<aspect name="com.baeldung.aspectj.SecuredMethodAspect"/>
|
||||
<weaver options="-verbose -showWeaveInfo">
|
||||
<include within="com.baeldung.aspectj.*"/>
|
||||
</weaver>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<!-- in order to debug some marshalling issues, this needs to be TRACE -->
|
||||
<logger name="org.springframework.web.servlet.mvc" level="WARN" />
|
||||
|
||||
<logger name="org.baeldung.performancemonitor.MyPerformanceMonitorInterceptor" level="INFO" />
|
||||
<logger name="com.baeldung.performancemonitor.MyPerformanceMonitorInterceptor" level="INFO" />
|
||||
|
||||
<logger name="org.springframework.aop.interceptor.PerformanceMonitorInterceptor" level="TRACE" />
|
||||
|
||||
|
|
|
@ -6,45 +6,45 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd">
|
||||
|
||||
<bean id="sampleAdder"
|
||||
class="org.baeldung.logger.SampleAdder" />
|
||||
class="com.baeldung.logger.SampleAdder" />
|
||||
|
||||
<bean id="doBeforeAspect" class="org.baeldung.logger.AdderBeforeAspect" />
|
||||
<bean id="doAfterAspect" class="org.baeldung.logger.AdderAfterAspect" />
|
||||
<bean id="doAfterThrowingAspect" class="org.baeldung.logger.AdderAfterThrowAspect" />
|
||||
<bean id="doAfterReturningAspect" class="org.baeldung.logger.AdderAfterReturnAspect" />
|
||||
<bean id="doAroundAspect" class="org.baeldung.logger.AdderAroundAspect" />
|
||||
<bean id="doBeforeAspect" class="com.baeldung.logger.AdderBeforeAspect" />
|
||||
<bean id="doAfterAspect" class="com.baeldung.logger.AdderAfterAspect" />
|
||||
<bean id="doAfterThrowingAspect" class="com.baeldung.logger.AdderAfterThrowAspect" />
|
||||
<bean id="doAfterReturningAspect" class="com.baeldung.logger.AdderAfterReturnAspect" />
|
||||
<bean id="doAroundAspect" class="com.baeldung.logger.AdderAroundAspect" />
|
||||
|
||||
<aop:config>
|
||||
|
||||
<aop:aspect id="aspects" ref="doBeforeAspect">
|
||||
<aop:pointcut id="pointCutBefore"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:before method="beforeAdvice" pointcut-ref="pointCutBefore" />
|
||||
</aop:aspect>
|
||||
|
||||
<aop:aspect id="aspects" ref="doAfterAspect">
|
||||
<aop:pointcut id="pointCutAfter"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:after method="afterAdvice" pointcut-ref="pointCutAfter" />
|
||||
</aop:aspect>
|
||||
|
||||
<aop:aspect id="aspects" ref="doAfterReturningAspect">
|
||||
<aop:pointcut id="pointCutAfterReturning"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:after-returning method="afterReturn"
|
||||
returning="returnValue" pointcut-ref="pointCutAfterReturning" />
|
||||
</aop:aspect>
|
||||
|
||||
<aop:aspect id="aspects" ref="doAfterThrowingAspect">
|
||||
<aop:pointcut id="pointCutAfterThrowing"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:after-throwing method="afterThrow"
|
||||
throwing="error" pointcut-ref="pointCutAfterThrowing" />
|
||||
</aop:aspect>
|
||||
|
||||
<aop:aspect id="aspects" ref="doAroundAspect">
|
||||
<aop:pointcut id="pointCutAround"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:around method="aroundAdvice" pointcut-ref="pointCutAround" />
|
||||
</aop:aspect>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung;
|
||||
package com.baeldung;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung;
|
||||
package com.baeldung;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.aspectj;
|
||||
package com.baeldung.aspectj;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.aspectj;
|
||||
package com.baeldung.aspectj;
|
||||
|
||||
import org.junit.Test;
|
||||
|
|
@ -1,29 +1,29 @@
|
|||
package org.baeldung.logger;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(value = {"classpath:springAop-applicationContext.xml"})
|
||||
public class CalculatorIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
private SampleAdder sampleAdder;
|
||||
|
||||
@Test
|
||||
public void whenAddValidValues_returnsSucessfully() {
|
||||
final int addedValue = sampleAdder.add(12, 12);
|
||||
|
||||
assertEquals(24, addedValue);
|
||||
}
|
||||
|
||||
@Test (expected = IllegalArgumentException.class)
|
||||
public void whenAddInValidValues_throwsException() {
|
||||
sampleAdder.add(12, -12);
|
||||
}
|
||||
|
||||
}
|
||||
package com.baeldung.logger;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(value = {"classpath:springAop-applicationContext.xml"})
|
||||
public class CalculatorIntegrationTest {
|
||||
|
||||
@Autowired
|
||||
private SampleAdder sampleAdder;
|
||||
|
||||
@Test
|
||||
public void whenAddValidValues_returnsSucessfully() {
|
||||
final int addedValue = sampleAdder.add(12, 12);
|
||||
|
||||
assertEquals(24, addedValue);
|
||||
}
|
||||
|
||||
@Test (expected = IllegalArgumentException.class)
|
||||
public void whenAddInValidValues_throwsException() {
|
||||
sampleAdder.add(12, -12);
|
||||
}
|
||||
|
||||
}
|
|
@ -6,45 +6,45 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd">
|
||||
|
||||
<bean id="sampleAdder"
|
||||
class="org.baeldung.logger.SampleAdder" />
|
||||
class="com.baeldung.logger.SampleAdder" />
|
||||
|
||||
<bean id="doBeforeAspect" class="org.baeldung.logger.AdderBeforeAspect" />
|
||||
<bean id="doAfterAspect" class="org.baeldung.logger.AdderAfterAspect" />
|
||||
<bean id="doAfterThrowingAspect" class="org.baeldung.logger.AdderAfterThrowAspect" />
|
||||
<bean id="doAfterReturningAspect" class="org.baeldung.logger.AdderAfterReturnAspect" />
|
||||
<bean id="doAroundAspect" class="org.baeldung.logger.AdderAroundAspect" />
|
||||
<bean id="doBeforeAspect" class="com.baeldung.logger.AdderBeforeAspect" />
|
||||
<bean id="doAfterAspect" class="com.baeldung.logger.AdderAfterAspect" />
|
||||
<bean id="doAfterThrowingAspect" class="com.baeldung.logger.AdderAfterThrowAspect" />
|
||||
<bean id="doAfterReturningAspect" class="com.baeldung.logger.AdderAfterReturnAspect" />
|
||||
<bean id="doAroundAspect" class="com.baeldung.logger.AdderAroundAspect" />
|
||||
|
||||
<aop:config>
|
||||
|
||||
<aop:aspect id="aspects" ref="doBeforeAspect">
|
||||
<aop:pointcut id="pointCutBefore"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:before method="beforeAdvice" pointcut-ref="pointCutBefore" />
|
||||
</aop:aspect>
|
||||
|
||||
<aop:aspect id="aspects" ref="doAfterAspect">
|
||||
<aop:pointcut id="pointCutAfter"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:after method="afterAdvice" pointcut-ref="pointCutAfter" />
|
||||
</aop:aspect>
|
||||
|
||||
<aop:aspect id="aspects" ref="doAfterReturningAspect">
|
||||
<aop:pointcut id="pointCutAfterReturning"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:after-returning method="afterReturn"
|
||||
returning="returnValue" pointcut-ref="pointCutAfterReturning" />
|
||||
</aop:aspect>
|
||||
|
||||
<aop:aspect id="aspects" ref="doAfterThrowingAspect">
|
||||
<aop:pointcut id="pointCutAfterThrowing"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:after-throwing method="afterThrow"
|
||||
throwing="exception" pointcut-ref="pointCutAfterThrowing" />
|
||||
</aop:aspect>
|
||||
|
||||
<aop:aspect id="aspects" ref="doAroundAspect">
|
||||
<aop:pointcut id="pointCutAround"
|
||||
expression="execution(* org.baeldung.logger.SampleAdder+.*(..))" />
|
||||
expression="execution(* com.baeldung.logger.SampleAdder+.*(..))" />
|
||||
<aop:around method="aroundAdvice" pointcut-ref="pointCutAround" />
|
||||
</aop:aspect>
|
||||
|
||||
|
|
Loading…
Reference in New Issue