mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add ibatis wrapper
This commit is contained in:
+1
-29
@@ -23,13 +23,8 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.aop.TargetSource;
|
||||
import org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.PatternMatchUtils;
|
||||
|
||||
import com.ibatis.sqlmap.client.SqlMapClient;
|
||||
@@ -41,30 +36,15 @@ import com.ibatis.sqlmap.engine.impl.ExtendedSqlMapClient;
|
||||
* @author hualiang.lihl 2011-12-31 上午10:48:20
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class SpringIbatisBeanTypeAutoProxyCreator extends AbstractAutoProxyCreator implements InitializingBean, ApplicationContextAware, SpringIbatisBeanTypeAutoProxyCreatorMBean {
|
||||
public class SpringIbatisBeanTypeAutoProxyCreator extends AbstractAutoProxyCreator implements SpringIbatisBeanTypeAutoProxyCreatorMBean {
|
||||
|
||||
private final static Log LOG = LogFactory.getLog(SpringIbatisBeanTypeAutoProxyCreator.class);
|
||||
|
||||
private static final long serialVersionUID = -9094985530794052264L;
|
||||
|
||||
private Class<?> targetBeanType = SqlMapClient.class;
|
||||
|
||||
private ApplicationContext context;
|
||||
|
||||
private List<String> beanNames = new ArrayList<String>();
|
||||
private final List<String> proxyBeanNames = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* @param targetClass the targetClass to set
|
||||
*/
|
||||
public void setTargetBeanType(Class<?> targetClass) {
|
||||
this.targetBeanType = targetClass;
|
||||
}
|
||||
|
||||
public void setApplicationContext(ApplicationContext context) throws BeansException {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify as bean to proxy if the bean name is in the configured list of names.
|
||||
*/
|
||||
@@ -124,14 +104,6 @@ public class SpringIbatisBeanTypeAutoProxyCreator extends AbstractAutoProxyCreat
|
||||
return PatternMatchUtils.simpleMatch(mappedName, beanName);
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(targetBeanType, "targetType cannot be null");
|
||||
String[] beanNames = context.getBeanNamesForType(targetBeanType);
|
||||
for (String name : beanNames) {
|
||||
this.beanNames.add(name);
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getBeanNames() {
|
||||
return beanNames;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user