Skip to content

Commit

Permalink
发布3.5.5-SNAPSHOT.
Browse files Browse the repository at this point in the history
  • Loading branch information
nieqiurong committed Oct 30, 2023
1 parent 663a779 commit 9da6eef
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 14 deletions.
1 change: 1 addition & 0 deletions changelog-temp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* fix: 修复Aop增强Mapper层导致的转换错误.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
APP_VERSION=3.5.4
APP_VERSION=3.5.5-SNAPSHOT
APP_GROUP=com.baomidou
signing.keyId=1FD337F9
signing.password=243194995
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,6 @@
@SuppressWarnings("unchecked")
public class ServiceImpl<M extends BaseMapper<T>, T> implements IService<T> {

private static boolean loadAop = false;

static {
try {
ClassUtils.toClassConfident("org.springframework.aop.framework.AopProxyUtils");
loadAop = true;
} catch (Exception exception) {
// ignore
}
}

private final ConversionService conversionService = DefaultConversionService.getSharedInstance();

protected final Log log = LogFactory.getLog(getClass());
Expand Down Expand Up @@ -101,8 +90,11 @@ protected SqlSessionFactory getSqlSessionFactory() {
synchronized (this) {
if (this.sqlSessionFactory == null) {
Object target = this.baseMapper;
if (loadAop && AopUtils.isAopProxy(this.baseMapper)) {
target = AopProxyUtils.getSingletonTarget(this.baseMapper);
// 这个检查目前看着来说基本上可以不用判断Aop是不是存在了.
if (com.baomidou.mybatisplus.extension.toolkit.AopUtils.isLoadSpringAop()) {
if (AopUtils.isAopProxy(this.baseMapper)) {
target = AopProxyUtils.getSingletonTarget(this.baseMapper);
}
}
if (target != null) {
MybatisMapperProxy mybatisMapperProxy = (MybatisMapperProxy) Proxy.getInvocationHandler(target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,35 @@
*/
public class AopUtils {

/**
* 是否加载Spring-Aop模块
*
* @since 3.5.4
*/
private static boolean loadAop = false;

static {
try {
ClassUtils.toClassConfident("org.springframework.aop.framework.AopProxyUtils");
loadAop = true;
} catch (Exception exception) {
// ignore
}
}

private static final Log logger = LogFactory.getLog(AopUtils.class);

/**
* 是否加载Spring-Aop模块
*
* @return 是否加载Spring-Aop模块
* @since 3.5.5
*/
public static boolean isLoadSpringAop() {
return loadAop;
}


/**
* 获取源目标对象
*
Expand Down

0 comments on commit 9da6eef

Please sign in to comment.