Merge pull request #219 from wenshao/master

add ibatis wrapper & logo
This commit is contained in:
温高铁
2012-12-08 21:47:47 -08:00
3 changed files with 13 additions and 29 deletions
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@@ -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;
}
@@ -12,6 +12,18 @@ http://www.springframework.org/schema/aop http://www.springframework.org/schema/
<property name="dataSource" ref="dataSource" />
</bean>
<bean class="com.alibaba.druid.support.mybatis.SqlWrapperCreator" >
</bean>
<bean class="com.alibaba.druid.support.mybatis.SqlWrapperNameCreator" >
<property name="beanNames">
<list>
<value>sqlSessionFactory</value>
</list>
</property>
</bean>
<bean class="org.mybatis.spring.mapper.MapperFactoryBean"
id="userMapper">
<property name="sqlSessionFactory" ref="sqlSessionFactory" />