Skip to content

Commit ee3b780

Browse files
author
chenl
committed
Merge branch 'master' of
https://github.com/chenlei2/spring-boot-mybatis-rw.git Conflicts: spring-boot-mybatis-rw/spring-boot-mybatis-rw-sample/.classpath spring-boot-mybatis-rw/spring-boot-mybatis-rw-sample/.settings/org.eclipse.jdt.core.prefs spring-boot-mybatis-rw/spring-boot-mybatis-rw-starter/src/main/java/org/spring/boot/mybatis/rw/starter/datasource/DataSourceProxy.java
2 parents 13cf7ba + ef734ae commit ee3b780

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
eclipse.preferences.version=1
22
encoding//src/main/java=UTF-8
33
encoding//src/main/resources=UTF-8
4+
encoding//src/test/java=UTF-8
45
encoding/<project>=UTF-8
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<faceted-project>
33
<installed facet="jst.utility" version="1.0"/>
4-
<installed facet="java" version="1.8"/>
4+
<installed facet="java" version="1.5"/>
55
</faceted-project>

spring-boot-mybatis-rw/spring-boot-mybatis-rw-starter/src/main/java/org/spring/boot/mybatis/rw/starter/datasource/DataSourceProxy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class DataSourceProxy implements DataSource {
3737
private DataSourceRout dataSourceRout;
3838

3939
/**
40-
* Create a new LazyConnectionDataSourceProxy.
40+
* Create a new LazyConnectionDataSourceProxy.a
4141
*
4242
* @see #setTargetDataSource
4343
*/
@@ -274,6 +274,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
274274
return null;
275275
}
276276
if (method.getName().equals("close")) {
277+
ConnectionHold.FORCE_WRITE.set(Boolean.FALSE);
277278
Map<String, Connection> connectionMap = ConnectionHold.CONNECTION_CONTEXT.get();
278279
Connection readCon = connectionMap.remove(ConnectionHold.READ);
279280
if (readCon != null) {
@@ -295,7 +296,6 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
295296
try {
296297
return method.invoke(
297298
ConnectionHold.CONNECTION_CONTEXT.get().get(ConnectionHold.CURRENT_CONNECTION.get()), args);
298-
299299
} catch (InvocationTargetException ex) {
300300
throw ex.getTargetException();
301301
}

spring-boot-mybatis-rw/spring-boot-mybatis-rw-starter/src/main/java/org/spring/boot/mybatis/rw/starter/pulgin/RWPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public Object intercept(Invocation invocation) throws Throwable {
5252
}
5353
String key = ConnectionHold.WRITE;
5454

55-
if (mappedStatement.getSqlCommandType() == SqlCommandType.SELECT) {
55+
if (mappedStatement.getSqlCommandType() == SqlCommandType.SELECT && !mappedStatement.getId().endsWith("!selectKey")) {
5656
key = ConnectionHold.READ;
5757
}
5858
routeConnection(key, conn);

0 commit comments

Comments
 (0)