Spring AOP | Code Factory

Spring Tutorial Index Page: Link

  • * AOP means Aspect Oriented Programming. The main aim of AOP is maintain independent business layer and service layer, seperate services from business.
    - Aspect = A service.
    - Advice = Service provider.
    - Point cut = A point/condition to execute aspects for business methods.
    - Advisor = Point cut with advice combination. Point cut + Advice
    - Proxy = A weaver. It will combine services code along with your business code.
  • * To add services to business, AOP we have 3 approaches.
    - Programmatic approach
    - Declarative approach
    - Annotations approach
  • * There are 4 types of advices in Spring AOP
    - MethodBeforeAdvice: Before Advice it is executed before the actual method call.
    - AfterReturningAdvice: After Advice it is executed after the actual method call. If method returns a value, it is executed after returning value.
    - MethodInterceptor: Around Advice it is executed before and after the actual method call.
    - ThrowsAdvice: Throws Advice it is executed if actual method throws exception.
  • ProxyFactoryBean is used to apply interceptor logic to an existing target bean, so that when methods on that bean are invoked, the interceptors are executed before-and-after that method call. This is an example of Aspect Oriented Programming (AOP).
  1. Spring AOP — Before Advice
  2. Spring AOP — After Returning Advice
  3. Spring AOP — Around Advice
  4. Spring AOP — Throwing Advice
  5. Spring AOP — Befor, After, Around Advice
  6. Spring AOP — Pointcut

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Career Recommendations or Self-fulfilling Prophecy?

Speed up your WordPress debugging skills using plugins, logs, and a local development environment—…

Python generator1 + generator2

Determined Now Supports Kubernetes!

Tutorial: IBM Cloud Pak single sign-on (SSO) integration with Ping Identity and Microsoft Active…

How to get an ambassador from the Aleo project?

Quick Start: How could you build a messaging solution with .Net Core? — Part 4

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Code Factory

Code Factory

More from Medium

Dependency Injection in Spring

Getting started with Helidon 2

Learn to use Spring Boot Initializr

Functional Interfaces in Java