What is Pointcut
of Spring AOP? let’s describe it. A Pointcut
defines what Advice
s are required at what Join Point
s. In fact all business logic methods of the class are not required all services, that means each business logic method might require different service even some methods don’t require. So Pointcut can informs IOC container that what business methods of a class needs what type of services.
In this type of Advice. This service executed when the logic method throws exceptions. To create Throws Advice, we should implement the interface called ThrowsAdvice
.
ThrowsAdvice
is provided by org.springframework.aop.* package. But it has not any method we need to override.
In this blog, let us talk about Around Advice
. There are some few points about it.
Around Advice
is combination ofBefore Advice
andAfter Advice
.- In a single
Around Advice
we can implement both before and after services. - Note,
Around Advice
is not given by spring framework, it is from Open Source implementation calledAOP
alliance. Around Advice
can be used by any framework which supportsAOP
.Around Advice
can access the return value of business method and it can modify the value and it can return a different value back to the client, as return type is Object, but in theAfter Advice
its not possible right, as its return type is void.
Advice
is the implementation of the cross-cutting
functionality. An Adivce
provides the code for implementation of the service.
There are four types of Advice:
- Before Advice
- After Advice
- Around Advice
- Throws Advice
As we know the Aspect
is just the name of the cross-cutting
functionality, not the implementation. So what’s the implementation of the cross-cutting
functionality? It’s called Advice
. An Advice
provides the code for implementation of the service. It is like Logging service, Logging is a Aspect
and Advice
denotes the implementation of Log4j.
An Aspect
represent the name of a cross-cutting
functionality, it’s only name not implementation.
Let us see the example.
1 | public class MyLogicClass |
What is AOP
?, AOP
stand for Aspect Oriented Programming
. It’s very important module for Spring
framework. In the enterprise level application programming we used to add different types of services to our application at runtime automatically, like logging, email, transaction, authentication services. These actions we called cross-cutting
functionalities. AOP
do this job.
From last blog, maybe you already love the Cobalt2
theme, like me. We usually use the terminal to do something we need. So can changed the theme for our terminal?
The answer is yes, we can. Let me show you screenshots firstly.
There is a sublime text theme I want to introduce to you guys. It’s called Cobalt2
, it not only colour scheme for editor window, but also it includes all sublime theme(e.g. sidebar, search, tabs, etc…). You can get it from github cobalt2.