diff --git a/mybatis-agent/src/main/java/com/plugins/mybaitslog/monitor/DynamicSqlSourceMonitor.java b/mybatis-agent/src/main/java/com/plugins/mybaitslog/monitor/DynamicSqlSourceMonitor.java
index e8f2373..6f0a376 100644
--- a/mybatis-agent/src/main/java/com/plugins/mybaitslog/monitor/DynamicSqlSourceMonitor.java
+++ b/mybatis-agent/src/main/java/com/plugins/mybaitslog/monitor/DynamicSqlSourceMonitor.java
@@ -1,11 +1,11 @@
package com.plugins.mybaitslog.monitor;
import com.linkkou.mybatis.log.LogInterceptor;
-import com.linkkou.mybatis.log.SubInterceptorChain;
import com.plugins.mybaitslog.IClassFileTransformer;
-import javassist.*;
-
-import java.util.Arrays;
+import javassist.ClassClassPath;
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtMethod;
/**
* A DynamicSqlSourceMonitor
Class
diff --git a/mybatis-plugin/src/main/java/com/linkkou/mybatis/log/LogInterceptor.java b/mybatis-plugin/src/main/java/com/linkkou/mybatis/log/LogInterceptor.java
index 9ed6d48..8ae398c 100644
--- a/mybatis-plugin/src/main/java/com/linkkou/mybatis/log/LogInterceptor.java
+++ b/mybatis-plugin/src/main/java/com/linkkou/mybatis/log/LogInterceptor.java
@@ -24,6 +24,7 @@
import java.lang.reflect.Field;
import java.text.DateFormat;
import java.util.*;
+import java.util.regex.Matcher;
/**
@@ -149,7 +150,7 @@ private Pair getArgs(Invocation invocation) {
*/
private String replaceFirst(String originalSql, String propertyName, String parameterValue) {
//(\$|#)\{\s*epNo2((?!\{).)*}
- return originalSql.replaceFirst("(\\$|#)\\{\\s*" + propertyName + "((?!\\{).)*}", parameterValue);
+ return originalSql.replaceFirst("(\\$|#)\\{\\s*" + Matcher.quoteReplacement(propertyName) + "((?!\\{).)*}", Matcher.quoteReplacement(parameterValue));
}
/**
diff --git a/mybatis-test/src/test/java/com/linkkou/mybatislog/mybatis/Index.java b/mybatis-test/src/test/java/com/linkkou/mybatislog/mybatis/Index.java
index 1ef48bc..928ad14 100644
--- a/mybatis-test/src/test/java/com/linkkou/mybatislog/mybatis/Index.java
+++ b/mybatis-test/src/test/java/com/linkkou/mybatislog/mybatis/Index.java
@@ -9,6 +9,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import java.time.LocalDate;
import java.util.List;
import java.util.concurrent.CountDownLatch;
@@ -64,6 +65,20 @@ public void queryByInjectD() {
System.out.println(employees);
}
+ @Test
+ public void queryByInjectE() {
+ final Employees employees = employeesDao.queryByInjectD("[httpServerRequest[ org.springframework.security.web.header.HeaderWriterFilter$HeaderWriterRequest@67b80766]]");
+ System.out.println(employees);
+ }
+
+
+ @Test
+ public void queryByInjectLocalDate() {
+ final LocalDate now = LocalDate.now();
+ final Employees employees = employeesDao.queryByInjectLocalDate(now);
+ System.out.println(employees);
+ }
+
@Test
public void queryByInjectThread() throws InterruptedException {
CountDownLatch countDownLatch = new CountDownLatch(1);
diff --git a/mybatis-test/src/test/java/com/linkkou/mybatislog/orm/dao/EmployeesDao.java b/mybatis-test/src/test/java/com/linkkou/mybatislog/orm/dao/EmployeesDao.java
index 70ba8d8..09e9ddd 100644
--- a/mybatis-test/src/test/java/com/linkkou/mybatislog/orm/dao/EmployeesDao.java
+++ b/mybatis-test/src/test/java/com/linkkou/mybatislog/orm/dao/EmployeesDao.java
@@ -6,6 +6,7 @@
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
+import java.time.LocalDate;
import java.util.List;
/**
@@ -89,6 +90,8 @@ public interface EmployeesDao {
Employees queryByInject(@Param("inject") String inject);
Employees queryByInjectD(@Param("inject") String inject);
+ Employees queryByInjectLocalDate(@Param("inject") LocalDate inject);
+
/**
* JSON
* @param inject
diff --git a/mybatis-test/src/test/resources/mapper/EmployeesMapper.xml b/mybatis-test/src/test/resources/mapper/EmployeesMapper.xml
index 622a957..eeac439 100644
--- a/mybatis-test/src/test/resources/mapper/EmployeesMapper.xml
+++ b/mybatis-test/src/test/resources/mapper/EmployeesMapper.xml
@@ -172,6 +172,18 @@
where emp_no = '#{inject}'
+
+
+