1 16 17 package org.springframework.aop.framework.autoproxy.target; 18 19 import org.springframework.aop.target.AbstractBeanFactoryBasedTargetSource; 20 import org.springframework.aop.target.CommonsPoolTargetSource; 21 import org.springframework.aop.target.PrototypeTargetSource; 22 import org.springframework.aop.target.ThreadLocalTargetSource; 23 24 36 public class QuickTargetSourceCreator extends AbstractBeanFactoryBasedTargetSourceCreator { 37 38 public static final String PREFIX_COMMONS_POOL = ":"; 39 public static final String PREFIX_THREAD_LOCAL = "%"; 40 public static final String PREFIX_PROTOTYPE = "!"; 41 42 protected final AbstractBeanFactoryBasedTargetSource createBeanFactoryBasedTargetSource( 43 Class beanClass, String beanName) { 44 45 if (beanName.startsWith(PREFIX_COMMONS_POOL)) { 46 CommonsPoolTargetSource cpts = new CommonsPoolTargetSource(); 47 cpts.setMaxSize(25); 48 return cpts; 49 } 50 else if (beanName.startsWith(PREFIX_THREAD_LOCAL)) { 51 return new ThreadLocalTargetSource(); 52 } 53 else if (beanName.startsWith(PREFIX_PROTOTYPE)) { 54 return new PrototypeTargetSource(); 55 } 56 else { 57 return null; 59 } 60 } 61 62 } 63 | Popular Tags |