concept AOP in category spring

This is an excerpt from Manning's book Spring Batch in Action.
Spring builds on this interface to implement standard transactional behavior and allows configuring transactions with Spring beans using AOP or annotations. This generic support doesn’t need to know which persistence technology is used and is completely independent of it.
Aspect-oriented programming is a programming paradigm that allows modularizing crosscutting concerns. The idea of AOP is to remove crosscutting concerns from an application’s main logic and implement them in dedicated units called aspects. Typical crosscutting concerns are transaction management, logging, security, and retry. The Spring Framework provides first-class support for AOP with its interceptor-based approach: Spring intercepts application code and calls aspect code to address crosscutting concerns. Thanks to AOP, boilerplate code doesn’t clutter the application code, and code aspects address crosscutting concerns in their own units, which also prevents code scattering.
Listing 8.12. Calling the web service without retry logic
package com.manning.sbia.ch08.retry; import java.util.List; import org.springframework.batch.core.StepContribution; import org.springframework.batch.core.scope.context.ChunkContext; import org.springframework.batch.core.step.tasklet.Tasklet; import org.springframework.batch.repeat.RepeatStatus; public class DiscountsTasklet implements Tasklet { private DiscountService discountService; private DiscountsHolder discountsHolder; @Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { List<Discount> discounts = discountService.getDiscounts(); discountsHolder.setDiscounts(discounts); return RepeatStatus.FINISHED; } (...) }If you want to keep the tasklet this simple, you need the magic of AOP to handle the retry transparently. Spring AOP wraps the target DiscountService—the one that makes the web service call—in a proxy. This proxy handles the retry logic thanks to the retry interceptor. The tasklet ends up using this proxy. The following listing shows the Spring configuration for transparent, AOP-based retry.