Home » Tag Archives: AOP

Tag Archives: AOP

Create your own AOP in Java

java-logo

Introduction As you know AOP is one of the best features provided by Spring framework which provides utmost flexibility while achieving cross cutting concerns. Have you thought of how AOP works in Spring ? Sometimes this is the question asked in case of senior level technical interview. Sometimes this question becomes more significant when it comes to only core java. ...

Read More »

Java Method Logging with AOP and Annotations

java-interview-questions-answers

Sometimes, I want to log (through slf4j and log4j) every execution of a method, seeing what arguments it receives, what it returns and how much time every execution takes. This is how I’m doing it, with help of AspectJ, jcabi-aspects and Java 6 annotations:                 public class Foo { @Loggable public int power(int ...

Read More »

Simple Aspect Oriented Programming (AOP) using CDI in JavaEE

java-interview-questions-answers

We write service APIs which cater to certain business logic. There are few cross-cutting concerns that cover all service APIs like Security, Logging, Auditing, Measuring Latencies and so on. This is a repetitive non-business code which can be reused among other methods. One way to reuse is to move these repetitive code into its own methods and invoke them in ...

Read More »

Applying aspect oriented programming

spring-interview-questions-answers

1.Introduction The main target of the aspect oriented programming is the separation of cross-cutting concerns. When we talk about cross-cutting concerns we are referring to generic functionality that is used in several places in our system or application. These concepts are, among others:         Logging Transaction management Error handling Monitoring Security The way to achieve this separation ...

Read More »

Java: Exception translation with AspectJ

aspectj-logo

Within this blog post I describe how you can use AspectJ to automatically translate one type of exception to another. The problem Sometimes we are in situations where we have to convert an exception (often thrown by a third-party library) to another type of exception. Assume you are using a persistence framework like hibernate and you do not want to ...

Read More »

Project Student: Simplifying Code With AOP

aspectj-logo

This is part of Project Student. Many people strongly believe that methods should fit within your editor window (say, 20 lines), and some people believe that methods should be even smaller than that. The idea is that a method should do one thing and only one thing. If it does more than that it should be broken apart into multiple ...

Read More »

Aspect Oriented Programming with Spring

spring-interview-questions-answers

Introduction In an ideal Object Oriented System, we would want to design each object to perform one specific task. However apart from performing its main task the objects also performs passive task like logging, transactions, security, caching etc. These passive activities which are necessary but not part of business logic are called “Cross Cutting Concerns“. (Cross Cutting Concerns == Commonly ...

Read More »

Understanding Dynamic Proxy: Spring AOP Basics

java-logo

Why AOP : To Understand AOP(Aspect Oriented Programming), we need to understand Cross Cutting Concerns in software development . In every project , there is some amount of code which gets repeated in multiple classes , across several modules.For example logging which needs to be done for almost all classes and for all module. This kind of code reduces code’s ...

Read More »

Getting rid of null parameters with a simple spring aspect

aspectj-logo

What is the most hated and at the same time the most popular exception in the world? I bet it’s the NullPointerException. NullPointerException can mean anything, from simple “ups, I didn’t think that can be null” to hours and days of debugging of third-party libraries (try using Dozer for complicated transformations, I dare you). The funny thing is, it’s trivial ...

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