Skip to content
Advertisement

How does the double-dot “..” syntax work in AspectJ?

i need to put this aop aspect to work, but i always get error 404, i need to know if this dots, after controller is right. idk how these dots works, to acess the controller.

if can explain how the dots works.

<aop:aspect ref="permissionInterceptor">
  <aop:around
    method="invoke"
    pointcut="execution(* com.teste1.teste2.web.controller..*())
      and @annotation(com.teste1.ae.client.security.Permission)"
  />
</aop:aspect>

Is this correct?

Advertisement

Answer

execution(* com.teste1.teste2.web.controller..*())

would mean – the execution of any method defined in the com.teste1.teste2.web.controller package or one of its sub-packages

.. is a special wild card which means any number of arguments will match. In the context of an execution pointcut it would be the current package or any sub-package of it.

Spring documentation reference : Examples

whereas (..) matches any number (zero or more) of parameters.

The expression with .. would work. You could verify if the controller methods gets advised when the and @annotation(com.teste1.ae.client.security.Permission) part is removed from the expression. If still the request results in 404 , please share the an MCVE or Aspect code to understand the logic further.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement