org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator Java Examples

The following examples show how to use org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EclairProxyCreator.java    From eclair with Apache License 2.0 6 votes vote down vote up
@Override
protected Object[] getAdvicesAndAdvisorsForBean(Class<?> beanClass, String beanName, TargetSource customTargetSource) throws BeansException {
    Class<?> targetClass = beanClassCache.computeIfAbsent(beanName, s -> ClassUtils.getUserClass(beanClass));
    Object[] cachedAdvisors = advisorsCache.get(targetClass);
    if (nonNull(cachedAdvisors)) {
        return cachedAdvisors.length == 0 ? AbstractAutoProxyCreator.DO_NOT_PROXY : cachedAdvisors;
    }
    if (!supports(targetClass)) {
        advisorsCache.put(targetClass, EMPTY_ARRAY);
        return AbstractAutoProxyCreator.DO_NOT_PROXY;
    }
    if (validate) {
        annotationExtractor.getCandidateMethods(targetClass).forEach(methodValidator::validate);
    }
    MdcAdvisor mdcAdvisor = getMdcAdvisor(targetClass);
    List<LogAdvisor> logAdvisors = getLoggingAdvisors(targetClass);
    Object[] composedAdvisors = composeAdvisors(mdcAdvisor, logAdvisors);
    advisorsCache.put(targetClass, composedAdvisors);
    return composedAdvisors.length == 0 ? AbstractAutoProxyCreator.DO_NOT_PROXY : composedAdvisors;
}