Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

297
Visualizações
@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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda