Spring AOP – AspectJ Annotation Example

In my previous tutorial I have shown how to write Spring AOP using XML configuration and in this tutorial I am going to show you how to write Annotation based Spring AOP using @AspectJ. This example creates annotation examples with @Aspect, @Pointcut, @Before, @After, @Around, @AfterReturning, @AfterThrowing Advice. @AspectJ is a style to declare aspects in a Java class using annotation. @EnableAspectJAutoProxy annotation is used in Java configuration to enable @AspectJ. To work with spring AOP and @AspectJ support, we need to create a class annotated with @Aspect annotation. Inside @Aspect annotated class we can create our pointcut and using pointcut we can also create our advice. Spring AOP is used for different purposes such as logging, transaction management, handling with exception and validating return value of a method.

Continue reading “Spring AOP – AspectJ Annotation Example”

Call Stored Procedure using Spring StoredProcedure

This tutorial will show you how we can stored procedure using Spring SimpleJdbcCall. For this tutorial we will create a standalone maven project in Eclipse.

If you already have an idea on how to create a maven project in Eclipse will be great otherwise I will tell you here how to create a maven project in Eclipse.

Sometimes we need to call a stored procedure while a single SQL statement is unable to fulfil our requirements because, it permits to execute multiple SQL statements and it also allows us to execute these SQL statements in a transactional unit in an efficient manner to avoid any inconsistency sometimes occurs during the execution of multiple SQL statements. Continue reading “Call Stored Procedure using Spring StoredProcedure”

Call Stored Procedure using Spring SimpleJdbcCall

This tutorial will show you how we can stored procedure using Spring SimpleJdbcCall. For this tutorial we will create a standalone maven project in Eclipse.

If you already have an idea on how to create a maven project in Eclipse will be great otherwise I will tell you here how to create a maven project in Eclipse.

Sometimes we need to call a stored procedure while a single SQL statement is unable to fulfil our requirements because, it permits to execute multiple SQL statements and it also allows us to execute these SQL statements in a transactional unit in an efficient manner to avoid any inconsistency sometimes occurs during the execution of multiple SQL statements. Continue reading “Call Stored Procedure using Spring SimpleJdbcCall”

Batch Insert using Spring JdbcTemplate

This tutorial will show you how we can insert a large dataset into a database at once using Spring JdbcTemplate. For this tutorial we will create a standalone maven project in Eclipse.

If you already have an idea on how to create a maven project in Eclipse will be great otherwise I will tell you here how to create a maven project in Eclipse.

Sometimes we need to insert or update large number of records in the database. It’s not a good idea to insert multiple records into database one by one in a traditional approach. It will hit the application’s performance. Spring provides batch operations with the help of JdbcTemplate, it inserts or updates records into database in one shot. Continue reading “Batch Insert using Spring JdbcTemplate”