I am using Spring <aop:aspectj-autoproxy /> to proxy some interfaces of the JPA repository .
However, proxying is not performed with the following Cannot subclass final class class $Proxy80 :
Failed to subclass CGLIB class class [class $ Proxy80]: Common causes of this problem include the use of a finite class or an invisible class; The nested exception is java.lang.IllegalArgumentException: Can not subclass class final class $ Proxy80
Like a bug, as well as a quick google, this suggests that this means that the target of the proxy is the final class. However, there are no classes in this chain — only interfaces. Spring generates all implementations at runtime.
Here is the definition of an interface that does not work:
public interface AuthorDAO extends CrossStoreJpaRepository<Author,Long>, CrossStoreQueryDslPredicateExecutor<Author> { }
Note. I use my own subclass of Spring JpaRepository and QueryDslPredicateExecutor , defined as follows:
public interface CrossStoreJpaRepository<T, ID extends Serializable> extends JpaRepository<T, ID> {} public interface CrossStoreQueryDslPredicateExecutor<T> extends QueryDslPredicateExecutor<T>{}
Elsewhere, I define user-specific aspects of methods on these interfaces:
@Aspect @Component public class DocumentLoadingAspect extends AbstractDocumentAspect { @Around("execution(* com.mangofactory.crossstore.repository.CrossStore*.find*(..))") public Object loadCrossStoreEntity(ProceedingJoinPoint pjp) throws Throwable {
I have confirmed that these are @Aspect definitions that cause the problem by deleting them and restarting the application.
What causes this error? It seems that the proxy server of the proxy server for some reason does not work.
java spring aspectj
Marty pitt
source share