Forgot to add the attachments Dne úterý 23. května 2017 15:53:15 UTC+2 Petr Strnad napsal(a): > > Hello, > > For some reason, there is a DefaultAdvisorAutoProxyCreator bean being > created in CasApplicationContextConfiguration > <https://github.com/apereo/cas/blob/5.0.x/webapp/cas-server-webapp-config/src/main/java/org/apereo/cas/config/CasApplicationContextConfiguration.java#L29>. > > However, Spring also automatically registers an > AnnotationAwareAspectJAutoProxyCreator. Is there any reason for the > DefaultAdvisorAutoProxyCreator > bean to exist? Right now, it only causes issues: > > It leads to the creation of nested proxies (com.sun.proxy.Proxy which > contains a CGLIB proxy). This can cause > ScheduledAnnotationBeanPostProcessor to fail to detect @Scheduled > annotation, because the use of AopUtils.getTargetClass(bean) > <https://github.com/spring-projects/spring-framework/blob/master/spring-context/src/main/java/org/springframework/scheduling/annotation/ScheduledAnnotationBeanPostProcessor.java#L300> > > only resolves the first proxy (so instead of returning the class of the > actual bean, it returns the class of the CGLIB proxy, which doesn't have > the @Scheduled annotation). > > This does not happen every time, because the order of BeanPostProcessors > seems to be partially random - it only happens when both > AnnotationAwareAspectJAutoProxyCreator > and DefaultAdvisorAutoProxyCreator are registered before > ScheduledAnnotationBeanPostProcessor. For example, on my local machine, the > order of the BeanPostProcessors pretty much always 'aligns' and therefore > @Scheduled works, but on our servers, about 80% of our packaged WARs fail. > > However, if you put a breakpoint to where DefaultTicketRegistryCleaner > bean is created > <https://github.com/apereo/cas/blob/5.0.x/core/cas-server-core-tickets/src/main/java/org/apereo/cas/config/CasCoreTicketsConfiguration.java#L288> > > and debug your way towards the post processors > <https://github.com/spring-projects/spring-framework/blob/master/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java#L429>, > > you will always see that there are two ProxyCreators, even if the order of > BeanPostProcessors is 'aligned' for @Scheduled to work (see the attachments) >
-- - CAS gitter chatroom: https://gitter.im/apereo/cas - CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html - CAS documentation website: https://apereo.github.io/cas - CAS project website: https://github.com/apereo/cas --- You received this message because you are subscribed to the Google Groups "CAS Community" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/fda4c14d-1621-4408-bf36-29304286fa22%40apereo.org.
