spring-framework / org.springframework.scheduling.annotation / EnableAsync / proxyTargetClass

proxyTargetClass

val proxyTargetClass: Boolean

Indicate whether subclass-based (CGLIB) proxies are to be created as opposed to standard Java interface-based proxies.

Applicable only if the #mode is set to AdviceMode#PROXY.

The default is false.

Note that setting this attribute to true will affect all Spring-managed beans requiring proxying, not just those marked with @Async. For example, other beans marked with Spring's @Transactional annotation will be upgraded to subclass proxying at the same time. This approach has no negative impact in practice unless one is explicitly expecting one type of proxy vs. another — for example, in tests.