diff --git a/pom.xml b/pom.xml
index 0f20a9303b..63ed95a808 100644
--- a/pom.xml
+++ b/pom.xml
@@ -188,8 +188,22 @@
org.springframework
- spring
- 2.0
+ spring-core
+ 3.1.1.RELEASE
+ provided
+ true
+
+
+ org.springframework
+ spring-beans
+ 3.1.1.RELEASE
+ provided
+ true
+
+
+ org.springframework
+ spring-ibatis
+ 2.0.8
provided
true
@@ -200,6 +214,13 @@
provided
true
+
+ org.mybatis
+ mybatis-spring
+ 1.1.1
+ provided
+ true
+
log4j
diff --git a/src/test/java/com/alibaba/druid/bvt/pool/SpringMybatisFilterTest.java b/src/test/java/com/alibaba/druid/bvt/pool/SpringMybatisFilterTest.java
new file mode 100644
index 0000000000..2bc99da8ca
--- /dev/null
+++ b/src/test/java/com/alibaba/druid/bvt/pool/SpringMybatisFilterTest.java
@@ -0,0 +1,79 @@
+package com.alibaba.druid.bvt.pool;
+
+import java.sql.Connection;
+import java.sql.Statement;
+
+import javax.sql.DataSource;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import com.alibaba.druid.spring.User;
+import com.alibaba.druid.stat.DruidDataSourceStatManager;
+
+public class SpringMybatisFilterTest extends TestCase {
+
+ protected void setUp() throws Exception {
+ Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
+ }
+
+ protected void tearDown() throws Exception {
+ Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
+ }
+
+ public void test_spring() throws Exception {
+ Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
+
+ ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
+ "com/alibaba/druid/pool/mybatis/spring-config-mybatis.xml");
+
+ DataSource dataSource = (DataSource) context.getBean("dataSource");
+
+ {
+ Connection conn = dataSource.getConnection();
+ Statement stmt = conn.createStatement();
+ stmt.execute("CREATE TABLE sequence_seed (value INTEGER, name VARCHAR(50))");
+ stmt.close();
+ conn.close();
+ }
+ {
+ Connection conn = dataSource.getConnection();
+ Statement stmt = conn.createStatement();
+ stmt.execute("CREATE TABLE t_User (id BIGINT, name VARCHAR(50))");
+ stmt.close();
+ conn.close();
+ }
+ {
+ Connection conn = dataSource.getConnection();
+ conn.setAutoCommit(false);
+ Statement stmt = conn.createStatement();
+ stmt.execute("insert into sequence_seed (value ,name) values (0, 'druid-spring-test')");
+ stmt.close();
+ conn.commit();
+ conn.close();
+ }
+
+ UserMapper userMapper = (UserMapper) context.getBean("userMapper");
+
+ {
+ User user = new User();
+ user.setName("xx");
+
+ userMapper.addUser(user);
+ }
+
+ context.close();
+
+ Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
+ }
+
+ public static interface UserMapper {
+
+ @Insert(value = "insert into t_User (id, name) values (#{user.id}, #{user.name})")
+ void addUser(@Param("user") User user);
+ }
+}
diff --git a/src/test/resources/com/alibaba/druid/pool/dataSource.xml b/src/test/resources/com/alibaba/druid/pool/dataSource.xml
index 839872d2dd..976ca8a8ba 100644
--- a/src/test/resources/com/alibaba/druid/pool/dataSource.xml
+++ b/src/test/resources/com/alibaba/druid/pool/dataSource.xml
@@ -7,7 +7,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"
default-lazy-init="false">
-
+
diff --git a/src/test/resources/com/alibaba/druid/pool/mbatis/spring-config-mbatis.xml b/src/test/resources/com/alibaba/druid/pool/mbatis/spring-config-mbatis.xml
deleted file mode 100644
index e68729677a..0000000000
--- a/src/test/resources/com/alibaba/druid/pool/mbatis/spring-config-mbatis.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/test/resources/com/alibaba/druid/pool/mybatis/spring-config-mybatis.xml b/src/test/resources/com/alibaba/druid/pool/mybatis/spring-config-mybatis.xml
new file mode 100644
index 0000000000..bc802baddd
--- /dev/null
+++ b/src/test/resources/com/alibaba/druid/pool/mybatis/spring-config-mybatis.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+