There is the part of the UI Controller
We need to check for every endpoint (methods): if a request comes from the ip which is contained in “blacklist” then error403.html (or what ever you want) should be returned.
AspectJ lets us to remove repeated “non business code” and place it to the “aspect”.
The last thing we need to setup is
pom.xml to properly weave our aspects.
There are some differences between Spring and non-Spring projects so carefully read this - Aspect weaving in Spring and non-Spring projects
You may also find these posts interesting: