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

300
Vistas
@Retryable doesn't work in spring-data repository interface

After I added @Retryable annotation to my spring-data-cassandra repository interface, now the application fails to start with following exception:

APPLICATION FAILED TO START

The bean 'airingDao' could not be injected as a 'my.dao.AiringDao' because it is a JDK dynamic proxy that implements:
org.springframework.data.cassandra.repository.CassandraRepository

Action:

Consider injecting the bean as one of its interfaces or forcing the use of CGLib-based proxies by setting proxyTargetClass=true on @EnableAsync and/or @EnableCaching.

Added proxyTargetClass=true to @EnableAsync and @EnableCaching, even to @EnableRetry(proxyTargetClass = true) @EnableAspectJAutoProxy(proxyTargetClass = true)

But still doesn't work.

After I remove the @Retryable, every thing works fine.

Checked the code, without @Retryable, in org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(String, Class<T>, Object[], boolean)

bean.getClass().getInterfaces()
   (java.lang.Class<T>[]) [interface my.dao.AiringDao, interface 
org.springframework.data.repository.Repository, interface 
org.springframework.transaction.interceptor.TransactionalProxy, interface 
org.springframework.aop.framework.Advised, interface 
org.springframework.core.DecoratingProxy]

So requiredType.isAssignableFrom(bean.getClass()) is true

But after added @Retryable:

bean.getClass().getInterfaces()
 (java.lang.Class<T>[]) [interface 
org.springframework.retry.interceptor.Retryable, interface 
org.springframework.aop.SpringProxy, interface 
org.springframework.aop.framework.Advised, interface 
org.springframework.core.DecoratingProxy]

So now requiredType.isAssignableFrom(bean.getClass())) is false and getTypeConverter().convertIfNecessary(bean, requiredType) throws the exception.

Could anyone please help or provide some clue how to troubleshoot it? Thanks for your help.

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Don't know Spring Retry, and haven't checked in detail, but I suspect, that there is no integration between Spring Data and Spring Retry yet. If this is true, you have two approaches available to you:

  1. Open an issue on Spring Data or Spring Retry to get the integration implemented.

  2. Introduce a separate layer for you @Retry which you then let delegate to your Spring Data repositories.

Of course those approaches aren't mutual exclusive.

about 4 years ago · Santiago Trujillo Denunciar

0

Here is a workaround provided. I raised an issue for this in Spring-Retry GitHub.

Spring-Retry Github Issue

about 4 years ago · Santiago Trujillo Denunciar
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