Configuring StatisticsListener (using interceptor)

In this post under Spring Retry, I will show with example how to configure StatisticsListener using interceptor. Below is the complete xml code which shows how to configure StatisticsListener using interceptor. XML Code 1 <?xml version=”1.0″ encoding=”UTF-8″?>2 <beans xmlns=”http://www.springframework.org/schema/beans”3 xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”4 xmlns:aop = “http://www.springframework.org/schema/aop”5 xsi:schemaLocation=”http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd6 http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd”>7 <aop:config>8 <aop:pointcut id=”transactional” expression=”execution(* defaultPackage.Service1.executeWithException(..))”/>9 <aop:advisor pointcut-ref=”transactional” advice-ref=”retryAdvice”/>10…… Continue reading Configuring StatisticsListener (using interceptor)

Configuring Recovery Callback (using interceptor)

In this post under Spring Retry –> XML Configuration –> Spring AOP, I will show with example how to configure RecoveryCallback using Spring AOP. For our example we will create a recovery class as shown below CustomMethodInvocationRecoverer package defaultPackage; import org.springframework.retry.interceptor.MethodInvocationRecoverer; public class CustomMethodInvocationRecoverer implements MethodInvocationRecoverer<Void> { @Override public Void recover(Object[] args, Throwable cause) {…… Continue reading Configuring Recovery Callback (using interceptor)

Configuring RetryTemplate (using Interceptor)

In the previous post under Spring Retry –> XML Configuration –> Spring AOP, I showed with example how to configure Spring Retry using interceptor. In that post I used RetryOperationsInterceptor class as shown in the below snippet. <bean id=”retryAdvice” class=”org.springframework.retry.interceptor.RetryOperationsInterceptor”/> In the above code snippet, I created a bean of RetryOperationsInterceptor which will create a…… Continue reading Configuring RetryTemplate (using Interceptor)

Spring Retry simple example (using interceptor)

In this post under Spring Retry, I will explain how to configure Spring Retry framework into your application using Spring AOP with simple example. At minimum, you need the below jars in your classpath1) spring-retry-1.3.1.jar2) commons-logging-1.2.jar3) spring-core-4.3.22.RELEASE.jar4) spring-aop-4.3.22.REELEASE.jar5) spring-beans-4.3.22.RELEASE.jar6) spring-context-4.3.22.RELEASE.jar7) spring-expression-4.3.22.RELEASE.jar8) aspectjweaver-1.8.9.jar For our example we will use the below service class Service1 public class…… Continue reading Spring Retry simple example (using interceptor)