Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

249
Vistas
Spring aspect support for repeatable annotation?

I have created a java8's repeatable annotation and want create an aspect before the method containing the annotation is invoked. This seems to work when method is annotated once but fails to invoke when I have repeatable annotation. I am using aspectjrt version 1.8.6. Looks like aspect doesn't support repeatable annotations. Any workaround?

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface MultiCacheEvicts
{
    MultiCacheEvict[] value();
}

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(MultiCacheEvicts.class)
public @interface MultiCacheEvict
{
    String value();

    String[] keyPrefix() default "";
}

@Aspect
public class MultiCacheEvictAdvice
{
    @Before("@annotation(multiCacheEvict)")
    public void cacheEvict(JoinPoint joinPoint, MultiCacheEvict 
    multiCacheEvict)
    { 
       //never gets invoked when repeatable annotation present on the method
    }
}

/**This works**/
@MultiCacheEvict(value = "default", keyPrefix ={"messageAttributes"})
public void purgeCache(Set<Long> userIds)

/**This doesn't works, advice never gets invoked**/
@MultiCacheEvict(value = "default", keyPrefix ={"messageAttributes"})
@MultiCacheEvict(value = "entity", keyPrefix ={"tagAttributes"})
public void purgeCache(Set<Long> userIds)
over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda