Home » Tag Archives: AOP (page 2)

Tag Archives: AOP

Spring – Adding AOP support

aspectj-logo

I heard a story about one senior (and quite highly paid) softwaree engineer. He was given task to log every method in every controller in project he was working on. Engineer rewrote all controller methods, so from code like this: @RequestMapping(method = RequestMethod.GET) public String showEmployees(Model model) { List<Employee> employees = employeeDao.list(); model.addAttribute('employees', employees); return 'employees/list'; } he made following ...

Read More »

Email filtering using Aspect and Spring Profile

spring-interview-questions-answers

During web application development, often the need for sending emails arise. However, sometimes the database is populated by data from production and there is a risk of sending emails to real customers during email test execution. This post will explain how to avoid it without explicitly write code in the send email function. We would use 2 techniques: Spring Profiles ...

Read More »

Reference to dynamic proxy in a proxied class

spring-interview-questions-answers

There was an interesting question in Stackoverflow about how a Spring Bean can get a reference to the proxy created by Spring to handle transactions, Spring AOP, Caching, Async flows etc. A reference to the proxy was required because if there is a call to itself by the proxied bean, this call would completely bypass the proxy. Consider an InventoryService ...

Read More »

A Simple Introduction to AOP

aspectj-logo

Why use AOP, a simple way to answer this question is to show an implementation of a cross cutting concern without using AOP. Consider a simple service and it’s implementation:                 public interface InventoryService { public Inventory create(Inventory inventory); public List<inventory> list(); public Inventory findByVin(String vin); public Inventory update(Inventory inventory); public boolean delete(Long ...

Read More »

AOP made easy with AspectJ and Spring

aspectj-logo

I recently started looking at Aspect Oriented Programming (AOP) and I’m finding it exciting to say the least. Of course I was acquainted with it, since I saw it used for transaction management within Spring but I have never looked at it in depth. In this article I want to show how quick it is to get up to speed ...

Read More »

Implementing Active Record Pattern with Spring AOP

aspectj-logo

During class design we should take decisions about the assignment of responsibilities that will have every class. If we have chosen well, systems tend to be easier to understand, maintain and extend. Almost all of our projects have a persistence layer, either relational database, document stores, or simply XML files. And typically you will use DAO pattern to implement abstract ...

Read More »

Practical Introduction into Code Injection with AspectJ, Javassist, and Java Proxy

aspectj-logo

The ability to inject pieces of code into compiled classes and methods, either statically or at runtime, may be of immense help. This applies especially to troubleshooting problems in third-party libraries without source codes or in an environment where it isn’t possible to use a debugger or a profiler. Code injection is also useful for dealing with concerns that cut ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close