Explore Java Hacks and Tutorials
Be Social. Be Updated.

Spring JdbcTemplate Example to Insert, Update


The following example illustrates using JdbcTemplate in Spring JDBC. This is an introductory example to the Spring JDBC module.

Dynamic Pointcut Example in Spring AOP

The following example illustrates using a dynamic pointcut. The difference between a static pointcut is that, in dynamic pointcut you can filter the method call instead of just the method. For example, you can apply the advice to ding(10); but not ding(20); In simple words, here you will get access to the argument values.

Static Pointcuts Example in Spring AOP


The following example illustrates creating a simple static pointcut in Spring AOP. As said in this post, a pointcut is a piece of code that decides for which methods the advice should be applied to.

Understanding Pointcut and Advisor in Spring AOP

Understanding pointcut and advisor in Spring

The following post teaches you the what is a point cut and advisor in Spring AOP.

Adding multiple advices in Spring AOP

Adding multiple advices in Spring
In this example we will see how to add multiple advices to methods in the target bean object. Adding multiple advices is necessary at times to differentiate the cross-cutting concerns. For example, in an advice you will want to log the details such as when the method is invoked and how much time it took to execute and in another advice you will want to check if the user has valid credentials to access that method etc.

Around Advice Example in Spring AOP

Around advice in Spring

In this example, we will see a simple example of around-advice. To write this advice, we take the help of MethodInterceptor interface.
Around Advice as the name says it, this advice executes both before and after the method execution.