Sebastian Dietrich opened SPR-12451 and commented

I have domain objects that need to be annotated both as @Configurable and @Validated. If I do so, I get an IllegalStateException when instantiating them in tests:

java.lang.IllegalStateException: Post-processor tried to replace bean instance of type [com.kratos.domain.profiles.Profile] with (proxy) object of type [com.sun.proxy.$Proxy81] - not supported for aspect-configured classes!
    at org.springframework.beans.factory.wiring.BeanConfigurerSupport.checkExposedObject(BeanConfigurerSupport.java:173)
    at org.springframework.beans.factory.wiring.BeanConfigurerSupport.configureBean(BeanConfigurerSupport.java:143)
    at org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect.configureBean(AnnotationBeanConfigurerAspect.aj:63)
    at org.springframework.beans.factory.aspectj.AbstractDependencyInjectionAspect.ajc$afterReturning$org_springframework_beans_factory_aspectj_AbstractDependencyInjectionAspect$2$1ea6722c(AbstractDependencyInjectionAspect.aj:88)

IMHO this is a typical need for DDD entities (they often have @Autowired references to e.g. repositories --> thus @Configurable - and they often need method-level validation for their business-functionality --> thus @Validated) .


Affects: 4.0.7

1 votes, 4 watchers