Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Pig
提交
37f94017
P
Pig
项目概览
int
/
Pig
上一次同步 10 个月
通知
8
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Pig
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
37f94017
编写于
9月 16, 2022
作者:
L
lbw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
⬆
Upgrading dependencies. seata 1.5.2 springbootadmin 2.7.5
上级
53449842
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
6 addition
and
182 deletion
+6
-182
README.md
README.md
+3
-2
pig-common/pig-common-feign/src/main/java/com/pig4cloud/pig/common/feign/sentinel/handle/GlobalBizExceptionHandler.java
...mmon/feign/sentinel/handle/GlobalBizExceptionHandler.java
+1
-1
pig-common/pig-common-seata/src/main/java/com/pig4cloud/pig/common/seata/config/SeataAutoConfiguration.java
...cloud/pig/common/seata/config/SeataAutoConfiguration.java
+1
-1
pig-common/pig-common-seata/src/main/java/io/seata/spring/util/SpringProxyUtils.java
.../src/main/java/io/seata/spring/util/SpringProxyUtils.java
+0
-177
pom.xml
pom.xml
+1
-1
未找到文件。
README.md
浏览文件 @
37f94017
...
...
@@ -2,13 +2,14 @@
<img
src=
"https://img.shields.io/badge/Pig-3.5-success.svg"
alt=
"Build Status"
>
<img
src=
"https://img.shields.io/badge/Spring%20Cloud-2021-blue.svg"
alt=
"Coverage Status"
>
<img
src=
"https://img.shields.io/badge/Spring%20Boot-2.7-blue.svg"
alt=
"Downloads"
>
<img
src=
"https://img.shields.io/badge/Vue-3.2-blue.svg"
alt=
"Downloads"
>
<img
src=
"https://img.shields.io/github/license/pig-mesh/pig"
/>
</p>
## 系统说明
-
基于 Spring Cloud 2021 、Spring Boot 2.7、 OAuth2 的 RBAC
**权限管理系统**
-
基于数据驱动视图的理念封装 element-
ui
,即使没有 vue 的使用经验也能快速上手
-
基于数据驱动视图的理念封装 element-
plus
,即使没有 vue 的使用经验也能快速上手
-
提供对常见容器化支持 Docker、Kubernetes、Rancher2 支持
-
提供 lambda 、stream api 、webflux 的生产实践
...
...
@@ -43,7 +44,7 @@
| Spring Authorization Server | 0.3.1 |
| Mybatis Plus | 3.5.2 |
| hutool | 5.8.7 |
| Avue |
2.6.18
|
| Avue |
3.1.3
|
### 模块说明
...
...
pig-common/pig-common-feign/src/main/java/com/pig4cloud/pig/common/feign/sentinel/handle/GlobalBizExceptionHandler.java
浏览文件 @
37f94017
...
...
@@ -104,7 +104,7 @@ public class GlobalBizExceptionHandler {
public
R
handleBodyValidException
(
MethodArgumentNotValidException
exception
)
{
List
<
FieldError
>
fieldErrors
=
exception
.
getBindingResult
().
getFieldErrors
();
log
.
warn
(
"参数绑定异常,ex = {}"
,
fieldErrors
.
get
(
0
).
getDefaultMessage
());
return
R
.
failed
(
fieldErrors
.
get
(
0
).
getDefaultMessage
(
));
return
R
.
failed
(
String
.
format
(
"%s %s"
,
fieldErrors
.
get
(
0
).
getField
(),
fieldErrors
.
get
(
0
).
getDefaultMessage
()
));
}
/**
...
...
pig-common/pig-common-seata/src/main/java/com/pig4cloud/pig/common/seata/config/SeataAutoConfiguration.java
浏览文件 @
37f94017
...
...
@@ -12,7 +12,7 @@ import org.springframework.context.annotation.PropertySource;
* @date 2022/3/29
*/
@PropertySource
(
value
=
"classpath:seata-config.yml"
,
factory
=
YamlPropertySourceFactory
.
class
)
@EnableAutoDataSourceProxy
@EnableAutoDataSourceProxy
(
useJdkProxy
=
true
)
@Configuration
(
proxyBeanMethods
=
false
)
public
class
SeataAutoConfiguration
{
...
...
pig-common/pig-common-seata/src/main/java/io/seata/spring/util/SpringProxyUtils.java
已删除
100644 → 0
浏览文件 @
53449842
/**
* @author lengleng
* @date 2022/3/29
*/
package
io.seata.spring.util
;
import
io.seata.common.util.CollectionUtils
;
import
io.seata.rm.tcc.remoting.parser.DubboUtil
;
import
org.springframework.aop.TargetSource
;
import
org.springframework.aop.framework.Advised
;
import
org.springframework.aop.framework.AdvisedSupport
;
import
org.springframework.aop.support.AopUtils
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Proxy
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
java.util.Set
;
/**
* Proxy tools base on spring 主要解决 v1.4.2 兼容性问题 https://github.com/seata/seata/issues/3709
*
* @author zhangsen
*/
public
class
SpringProxyUtils
{
private
SpringProxyUtils
()
{
}
/**
* Find target class class.
* @param proxy the proxy
* @return the class
* @throws Exception the exception
*/
public
static
Class
<?>
findTargetClass
(
Object
proxy
)
throws
Exception
{
if
(
proxy
==
null
)
{
return
null
;
}
if
(
AopUtils
.
isAopProxy
(
proxy
)
&&
proxy
instanceof
Advised
)
{
// #issue 3709
final
TargetSource
targetSource
=
((
Advised
)
proxy
).
getTargetSource
();
if
(!
targetSource
.
isStatic
())
{
return
targetSource
.
getTargetClass
();
}
return
findTargetClass
(
targetSource
.
getTarget
());
}
return
proxy
.
getClass
();
}
public
static
Class
<?>[]
findInterfaces
(
Object
proxy
)
throws
Exception
{
if
(
AopUtils
.
isJdkDynamicProxy
(
proxy
))
{
AdvisedSupport
advised
=
getAdvisedSupport
(
proxy
);
return
getInterfacesByAdvised
(
advised
);
}
else
{
return
new
Class
<?>[]
{};
}
}
private
static
Class
<?>[]
getInterfacesByAdvised
(
AdvisedSupport
advised
)
{
Class
<?>[]
interfaces
=
advised
.
getProxiedInterfaces
();
if
(
interfaces
.
length
>
0
)
{
return
interfaces
;
}
else
{
throw
new
IllegalStateException
(
"Find the jdk dynamic proxy class that does not implement the interface"
);
}
}
/**
* Gets advised support.
* @param proxy the proxy
* @return the advised support
* @throws Exception the exception
*/
public
static
AdvisedSupport
getAdvisedSupport
(
Object
proxy
)
throws
Exception
{
Field
h
;
if
(
AopUtils
.
isJdkDynamicProxy
(
proxy
))
{
h
=
proxy
.
getClass
().
getSuperclass
().
getDeclaredField
(
"h"
);
}
else
{
h
=
proxy
.
getClass
().
getDeclaredField
(
"CGLIB$CALLBACK_0"
);
}
h
.
setAccessible
(
true
);
Object
dynamicAdvisedInterceptor
=
h
.
get
(
proxy
);
Field
advised
=
dynamicAdvisedInterceptor
.
getClass
().
getDeclaredField
(
"advised"
);
advised
.
setAccessible
(
true
);
return
(
AdvisedSupport
)
advised
.
get
(
dynamicAdvisedInterceptor
);
}
/**
* Is proxy boolean.
* @param bean the bean
* @return the boolean
*/
public
static
boolean
isProxy
(
Object
bean
)
{
if
(
bean
==
null
)
{
return
false
;
}
// check dubbo proxy ?
return
DubboUtil
.
isDubboProxyName
(
bean
.
getClass
().
getName
())
||
(
Proxy
.
class
.
isAssignableFrom
(
bean
.
getClass
())
||
AopUtils
.
isAopProxy
(
bean
));
}
/**
* Get the target class , get the interface of its agent if it is a Proxy
* @param proxy the proxy
* @return target interface
* @throws Exception the exception
*/
public
static
Class
<?>
getTargetInterface
(
Object
proxy
)
throws
Exception
{
if
(
proxy
==
null
)
{
throw
new
java
.
lang
.
IllegalArgumentException
(
"proxy can not be null"
);
}
// jdk proxy
if
(
Proxy
.
class
.
isAssignableFrom
(
proxy
.
getClass
()))
{
Proxy
p
=
(
Proxy
)
proxy
;
return
p
.
getClass
().
getInterfaces
()[
0
];
}
return
getTargetClass
(
proxy
);
}
/**
* Get the class type of the proxy target object, if hadn't a target object, return
* the interface of the proxy
* @param proxy the proxy
* @return target interface
* @throws Exception the exception
*/
protected
static
Class
<?>
getTargetClass
(
Object
proxy
)
throws
Exception
{
if
(
proxy
==
null
)
{
throw
new
java
.
lang
.
IllegalArgumentException
(
"proxy can not be null"
);
}
// not proxy
if
(!
AopUtils
.
isAopProxy
(
proxy
))
{
return
proxy
.
getClass
();
}
AdvisedSupport
advisedSupport
=
getAdvisedSupport
(
proxy
);
Object
target
=
advisedSupport
.
getTargetSource
().
getTarget
();
/*
* the Proxy of sofa:reference has no target
*/
if
(
target
==
null
)
{
if
(
CollectionUtils
.
isNotEmpty
(
advisedSupport
.
getProxiedInterfaces
()))
{
return
advisedSupport
.
getProxiedInterfaces
()[
0
];
}
else
{
return
proxy
.
getClass
();
}
}
else
{
return
getTargetClass
(
target
);
}
}
/**
* get the all interfaces of bean, if the bean is null, then return empty array
* @param bean the bean
* @return target interface
*/
public
static
Class
<?>[]
getAllInterfaces
(
Object
bean
)
{
Set
<
Class
<?>>
interfaces
=
new
HashSet
<>();
if
(
bean
!=
null
)
{
Class
<?>
clazz
=
bean
.
getClass
();
while
(!
Object
.
class
.
getName
().
equalsIgnoreCase
(
clazz
.
getName
()))
{
Class
<?>[]
clazzInterfaces
=
clazz
.
getInterfaces
();
interfaces
.
addAll
(
Arrays
.
asList
(
clazzInterfaces
));
clazz
=
clazz
.
getSuperclass
();
}
}
return
interfaces
.
toArray
(
new
Class
[
0
]);
}
}
pom.xml
浏览文件 @
37f94017
...
...
@@ -33,7 +33,7 @@
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<maven.compiler.source>
1.8
</maven.compiler.source>
<maven.compiler.target>
1.8
</maven.compiler.target>
<spring-boot-admin.version>
2.7.
4
</spring-boot-admin.version>
<spring-boot-admin.version>
2.7.
5
</spring-boot-admin.version>
<spring.authorization.version>
0.3.1
</spring.authorization.version>
<hutool.version>
5.8.7
</hutool.version>
<dynamic-ds.version>
3.5.1
</dynamic-ds.version>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录