Photo by Isaac Benhesed on Unsplash

I use AOP for all kinds of stuff. I love having a clear separation between the main code and the cross-cutting concerns and, once you understand how AOP works in Spring and get used to the terminology, there is no coming back.

One scenario where I use AOP extensively is to advise controller methods. But I have a problem with what I consider to be the “classic way” of doing AOP.

Let me explain.

The classic way: get parameters from joinpoint

I call “the classic way” of doing AOP to an implementation with the following characteristics:


Photo by Miryam León on Unsplash

Method argument resolvers are a great tool to keep your Spring application clean. Implementing the interface HandlerMethodArgumentResolver you can extract the logic needed to instantiate a custom-typed argument to a component and keep your controllers clean.

But in some situations, using method argument resolvers can lead to less-than-ideal performance.

What am I talking about

I’ll show you using an example:


There are plenty of solutions out there to implement pagination in REST APIs. This story is not about best practices or the solution I personally like the most. It is, instead, about how to implement one of the commonly used alternatives as cleanly as possible using Spring Boot and JPA.

The pagination alternative covered in this story uses a couple of URL parameters for pagination and returns a collection of resource items and a header with the total elements in the collection. For a paginated collection of Resource items, the call would look like: GET /api/resources?_start=10&_end=15. Let’s say that our…


Photo by Clem Onojeghuo on Unsplash

It’s been a while since the last time you had the pleasure of having your application consumed from an Iframe. But some legacy application “needs” to do exactly that. You test the “integration” and it doesn’t work. The cookies for the requests made by the Iframe don’t make its way to the server.

Sounds Familiar? It happened to me some time ago and it took some digging around to understand and diagnose the problem. …


Photo by Artem Maltsev on Unsplash

AOP is a great tool for keeping your codebase clean. It allows you to keep your code focused on the main task at hand and extract all the cutting concerns to manageable pieces of code.

I have taught some AOP lessons lately and have observed that most (junior) developers have a certain degree of fear of AOP that prevents them from taking advantage of it. The problem is, in my opinion, more a matter of poor knowledge of the internals, obscure syntax, and inconvenient APIs than a problem based on real complexity.

In this article, we are going to cover…


Photo by Mike Szczepanski on Unsplash

One of the advantages of JWT tokens is that you can validate a token using a simple cryptographic operation. This is a really beautiful feature that is the result of how JWT is designed: JWT tokens are simply encoded and signed JSON.

Any client can check the signature. The client just needs access to the public/private part of the key set used for signing (depending on the algorithm). And here is where JWKS comes in handy.

JWK stands for JSON Web Key and it is a JSON data structure that represents a cryptographic key. The trailing S in JWKS means…


Photo by Louis Reed on Unsplash

Mockito is a mocking library for Java. It provides a simple API that allows you to tailor the behavior of your mocks to your specific needs. Mockito is a powerful tool and provides support for almost any testing scenario you can think about. In this article, we will take a look at some advanced stuff you can do with this library.

With great power comes great responsibility

Using mockito you can implement really complex interactions. But most of the time you don’t want to use all that power. I have seen overcomplicated tests plenty of times. I have implemented overcomplicated tests that don’t provide any advantage…


Photo by Rahul Bhogal on Unsplash

In any non-trivial Java application, you are almost guaranteed to have the need of converting between different kinds of objects. A classic example of this need is the conversion from domain objects to API-specific representations…but this is just one example. Complex systems are comprised of multiple layers with different levels of abstraction and, at some point, we usually need to convert back and forth between those levels.

A while ago I wrote a story about code generation with Lombok project. Lombok allows us to write less code in our POJOs. …


Photo by Michael Dziedzic on Unsplash

Here at Trabe, we have been using GraphQL for a while. We started our dive in this technology with pure JavaScript projects but, after realizing how well GraphQL and React play together, we decided to adopt it for all new projects involving a React UI.

Since a good number of our projects are based on a server-side Java stack, we spent some time benchmarking the available GraphQL libraries for the Java ecosystem. …


Photo by Gerrie van der Walt on Unsplash

In recent years we have been involved in a variety of projects comprised of distributed components that have all sorts of communication needs between them.

We wrote about one specific case a while back. In that case, we used MQTT for cache invalidation. This story is, in some sense, a follow up to that one, focusing on a completely different scenario and technology but sharing the main subject of “real time” communication between distributed systems.

The problem we have

In our project, we have components generating events (Producers) and components that need to consume those events (Consumers). …

Marcos Abel

Co founder@ Trabe Soluciones

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store