spring
spring copied to clipboard
ClassCastException when using @EnableAsync in Spring
@heruan commented on Fri Apr 06 2018
With Spring, if using @EnableAsync
I'm starting getting cast exceptions e.g.
java.lang.ClassCastException: com.sun.proxy.$Proxy319 cannot be cast to
com.vaadin.flow.component.Component
but if I set @EnableAsync(proxyTargetClass = true)
then all is working again.
I don't know what happens exactly here, but from the annotation docs I understand that the annotation changes the way all proxy are created—not just @Async
annotated ones.
Don't know if this is something that should be fixed in Flow or just documented.
I also had this issue but it resolved when I removed the @EnableGlobalMethodSecurity(securedEnabled = true)
annotation I was using. As soon as I add the flag proxyTargetClass = true
it works again. The view that caused the issue had a @Secured
annotation and configuration similar to the bakery example.
I'm not yet sure if this is the real solution and if the Secured annotation for any REST interfaces besides the Vaadin application is still working but a hint in the direction where the problem is located.