Merge branch 'dev'

This commit is contained in:
lbw 2021-01-31 19:13:45 +08:00
commit 7b6320427c
29 changed files with 68 additions and 58 deletions

View File

@ -98,7 +98,7 @@ mvn archetype:generate \
-Dpackage=com.pig4cloud.pig.demo \
-DarchetypeGroupId=com.pig4cloud.archetype \
-DarchetypeArtifactId=pig-gen \
-DarchetypeVersion=3.0.3 \
-DarchetypeVersion=3.0.4 \
-DarchetypeCatalog=local
```

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-auth</artifactId>
@ -44,19 +44,19 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-feign</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</dependency>
<!--upms api、model 模块-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</dependency>
<!--security-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-security</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</dependency>
<!--JDBC相关-->
<dependency>

View File

@ -18,14 +18,16 @@ package com.pig4cloud.pig.auth;
import com.pig4cloud.pig.common.feign.annotation.EnablePigFeignClients;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* @author lengleng
* @date 2018年06月21日 认证授权中心
*/
@EnablePigFeignClients
@SpringCloudApplication
@EnableDiscoveryClient
@SpringBootApplication
public class PigAuthApplication {
public static void main(String[] args) {

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-common-core</artifactId>

View File

@ -21,7 +21,7 @@
<parent>
<artifactId>pig-common</artifactId>
<groupId>com.pig4cloud</groupId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -33,7 +33,7 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>

View File

@ -16,6 +16,11 @@
package com.pig4cloud.pig.common.feign.ext;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Map;
import com.alibaba.cloud.sentinel.feign.SentinelContractHolder;
import feign.Contract;
import feign.Feign;
@ -23,17 +28,14 @@ import feign.InvocationHandlerFactory;
import feign.Target;
import org.springframework.beans.BeansException;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.FeignContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Map;
/**
* 支持自动降级注入 重写 {@link com.alibaba.cloud.sentinel.feign.SentinelFeign}
*
@ -74,27 +76,25 @@ public final class PigSentinelFeign {
super.invocationHandlerFactory(new InvocationHandlerFactory() {
@Override
public InvocationHandler create(Target target, Map<Method, MethodHandler> dispatch) {
// using reflect get fallback and fallbackFactory properties from
// FeignClientFactoryBean because FeignClientFactoryBean is a package
// level class, we can not use it in our package
Object feignClientFactoryBean = PigSentinelFeign.Builder.this.applicationContext
.getBean("&" + target.type().getName());
Class fallback = (Class) getFieldValue(feignClientFactoryBean, "fallback");
Class fallbackFactory = (Class) getFieldValue(feignClientFactoryBean, "fallbackFactory");
String beanName = (String) getFieldValue(feignClientFactoryBean, "contextId");
// 查找 FeignClient 上的 降级策略
FeignClient feignClient = AnnotationUtils.findAnnotation(target.type(), FeignClient.class);
Class fallback = feignClient.fallback();
Class fallbackFactory = feignClient.fallbackFactory();
String beanName = feignClient.contextId();
if (!StringUtils.hasText(beanName)) {
beanName = (String) getFieldValue(feignClientFactoryBean, "name");
beanName = feignClient.name();
}
Object fallbackInstance;
FallbackFactory fallbackFactoryInstance;
// check fallback and fallbackFactory properties
if (void.class != fallback) {
fallbackInstance = getFromContext(beanName, "fallback", fallback, target.type());
return new PigSentinelInvocationHandler(target, dispatch,
new FallbackFactory.Default(fallbackInstance));
}
if (void.class != fallbackFactory) {
fallbackFactoryInstance = (FallbackFactory) getFromContext(beanName, "fallbackFactory",
fallbackFactory, FallbackFactory.class);

View File

@ -23,7 +23,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-common-job</artifactId>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-common-log</artifactId>
@ -35,13 +35,13 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</dependency>
<!--UPMS接口模块-->
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</dependency>
<!--安全依赖获取上下文信息-->
<dependency>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-common-mybatis</artifactId>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-common-security</artifactId>
@ -35,7 +35,7 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-core</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</dependency>
<!--安全模块-->
<dependency>
@ -46,7 +46,7 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms-api</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</dependency>
</dependencies>
</project>

View File

@ -24,7 +24,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-common-swagger</artifactId>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-common-test</artifactId>
@ -18,7 +18,7 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-common-security</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-common</artifactId>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-gateway</artifactId>

View File

@ -18,7 +18,8 @@ package com.pig4cloud.pig.gateway;
import com.pig4cloud.pig.common.swagger.annotation.EnablePigSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* @author lengleng
@ -27,7 +28,8 @@ import org.springframework.cloud.client.SpringCloudApplication;
* 网关应用
*/
@EnablePigSwagger2
@SpringCloudApplication
@EnableDiscoveryClient
@SpringBootApplication
public class PigGatewayApplication {
public static void main(String[] args) {

View File

@ -18,7 +18,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-register</artifactId>

View File

@ -31,6 +31,8 @@ spring:
url: http://pig-monitor:5001
username: pig
password: pig
instance:
prefer-ip: true
application:
name: @project.artifactId@

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-upms-api</artifactId>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-upms</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-upms-biz</artifactId>

View File

@ -20,7 +20,8 @@ import com.pig4cloud.pig.common.feign.annotation.EnablePigFeignClients;
import com.pig4cloud.pig.common.security.annotation.EnablePigResourceServer;
import com.pig4cloud.pig.common.swagger.annotation.EnablePigSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* @author lengleng
@ -29,7 +30,8 @@ import org.springframework.cloud.client.SpringCloudApplication;
@EnablePigSwagger2
@EnablePigResourceServer
@EnablePigFeignClients
@SpringCloudApplication
@EnableDiscoveryClient
@SpringBootApplication
public class PigAdminApplication {
public static void main(String[] args) {

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-upms</artifactId>

View File

@ -22,7 +22,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-visual</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-codegen</artifactId>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-visual</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-monitor</artifactId>

View File

@ -18,14 +18,16 @@ package com.pig4cloud.pig.monitor;
import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* @author lengleng
* @date 2018年06月21日 监控中心
*/
@EnableAdminServer
@SpringCloudApplication
@EnableDiscoveryClient
@SpringBootApplication
public class PigMonitorApplication {
public static void main(String[] args) {

View File

@ -6,7 +6,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-visual</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-sentinel-dashboard</artifactId>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig-visual</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-xxl-job-admin</artifactId>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<artifactId>pig-visual</artifactId>

View File

@ -23,20 +23,20 @@
<!-- 源码: https://gitee.com/log4j/pig-cloud-dependencies-parent -->
<groupId>com.pig4cloud</groupId>
<artifactId>pig-cloud-dependencies-parent</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
</parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pig</artifactId>
<version>3.0.3</version>
<version>3.0.4</version>
<name>${project.artifactId}</name>
<packaging>pom</packaging>
<url>https://www.pig4cloud.com</url>
<properties>
<spring-boot.version>2.4.2</spring-boot.version>
<spring-cloud.version>2020.0.0</spring-cloud.version>
<spring-cloud-alibaba.version>2.2.4.RELEASE</spring-cloud-alibaba.version>
<spring-cloud.version>2020.0.1</spring-cloud.version>
<spring-cloud-alibaba.version>2.2.5.RC2</spring-cloud-alibaba.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>