1 16 17 package org.springframework.aop.framework.autoproxy.target; 18 19 import org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource; 20 import org.springframework.aop.target.AbstractPoolingTargetSource; 21 import org.springframework.aop.target.CommonsPoolTargetSource; 22 23 31 public abstract class AbstractPoolingTargetSourceCreator extends AbstractBeanFactoryBasedTargetSourceCreator { 32 33 protected final AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource( 34 Class beanClass, String beanName) { 35 36 PoolingAttribute poolingAttribute = getPoolingAttribute(beanClass, beanName); 37 if (poolingAttribute == null) { 38 return null; 40 } 41 else { 42 AbstractPoolingTargetSource targetSource = newPoolingTargetSource(poolingAttribute); 43 targetSource.setMaxSize(poolingAttribute.getSize()); 44 return targetSource; 45 } 46 } 47 48 56 protected AbstractPoolingTargetSource newPoolingTargetSource(PoolingAttribute poolingAttribute) { 57 return new CommonsPoolTargetSource(); 58 } 59 60 66 protected abstract PoolingAttribute getPoolingAttribute(Class beanClass, String beanName); 67 68 } 69 | Popular Tags |