【修改】将jeecg字样修改为jero
This commit is contained in:
@@ -35,13 +35,13 @@ spring:
|
||||
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://127.0.0.1:3306/jero-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 多数据源配置
|
||||
#multi-datasource1:
|
||||
#url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
#url: jdbc:mysql://localhost:3306/jero-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
#username: root
|
||||
#password: root
|
||||
#driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
@@ -97,7 +97,7 @@ jeecg :
|
||||
staticDomain: ??
|
||||
# ElasticSearch 6设置
|
||||
elasticsearch:
|
||||
cluster-name: jeecg-ES
|
||||
cluster-name: jero-ES
|
||||
cluster-nodes: 127.0.0.1:9200
|
||||
check-enabled: false
|
||||
# 表单设计器配置
|
||||
@@ -140,7 +140,7 @@ jeecg :
|
||||
#自定义路由配置 yml nacos database
|
||||
route:
|
||||
config:
|
||||
data-id: jeecg-gateway-router
|
||||
data-id: jero-gateway-router
|
||||
group: DEFAULT_GROUP
|
||||
data-type: yml
|
||||
#分布式锁配置
|
||||
@@ -152,7 +152,7 @@ jeecg :
|
||||
#Mybatis输出sql日志
|
||||
logging:
|
||||
level:
|
||||
org.jeecg.modules.system.mapper : info
|
||||
com.jero.modules.system.mapper : info
|
||||
#cas单点登录
|
||||
cas:
|
||||
prefixUrl: http://localhost:8888/cas
|
||||
@@ -171,16 +171,16 @@ justauth:
|
||||
GITHUB:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/thirdLogin/github/callback
|
||||
redirect-uri: http://sso.test.com:8080/jero-boot/thirdLogin/github/callback
|
||||
WECHAT_ENTERPRISE:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/thirdLogin/wechat_enterprise/callback
|
||||
redirect-uri: http://sso.test.com:8080/jero-boot/thirdLogin/wechat_enterprise/callback
|
||||
agent-id: 1000002
|
||||
DINGTALK:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/thirdLogin/dingtalk/callback
|
||||
redirect-uri: http://sso.test.com:8080/jero-boot/thirdLogin/dingtalk/callback
|
||||
cache:
|
||||
type: default
|
||||
prefix: 'demo::'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[{
|
||||
"id": "jeecg-system",
|
||||
"id": "jero-system",
|
||||
"order": 0,
|
||||
"predicates": [{
|
||||
"name": "Path",
|
||||
@@ -18,9 +18,9 @@
|
||||
}
|
||||
}],
|
||||
"filters": [],
|
||||
"uri": "lb://jeecg-system"
|
||||
"uri": "lb://jero-system"
|
||||
}, {
|
||||
"id": "jeecg-demo",
|
||||
"id": "jero-demo",
|
||||
"order": 1,
|
||||
"predicates": [{
|
||||
"name": "Path",
|
||||
@@ -32,9 +32,9 @@
|
||||
}
|
||||
}],
|
||||
"filters": [],
|
||||
"uri": "lb://jeecg-demo"
|
||||
"uri": "lb://jero-demo"
|
||||
}, {
|
||||
"id": "jeecg-system-websocket",
|
||||
"id": "jero-system-websocket",
|
||||
"order": 2,
|
||||
"predicates": [{
|
||||
"name": "Path",
|
||||
@@ -45,9 +45,9 @@
|
||||
}
|
||||
}],
|
||||
"filters": [],
|
||||
"uri": "lb:ws://jeecg-system"
|
||||
"uri": "lb:ws://jero-system"
|
||||
}, {
|
||||
"id": "jeecg-demo-websocket",
|
||||
"id": "jero-demo-websocket",
|
||||
"order": 3,
|
||||
"predicates": [{
|
||||
"name": "Path",
|
||||
@@ -56,5 +56,5 @@
|
||||
}
|
||||
}],
|
||||
"filters": [],
|
||||
"uri": "lb:ws://jeecg-demo"
|
||||
"uri": "lb:ws://jero-demo"
|
||||
}]
|
||||
-76
@@ -1,76 +0,0 @@
|
||||
package org.jeecg.config;
|
||||
|
||||
import feign.Feign;
|
||||
import feign.Logger;
|
||||
import feign.RequestInterceptor;
|
||||
import feign.codec.Encoder;
|
||||
import feign.form.spring.SpringFormEncoder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.springframework.beans.factory.ObjectFactory;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
||||
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
|
||||
import org.springframework.cloud.openfeign.support.SpringEncoder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
|
||||
@ConditionalOnClass(Feign.class)
|
||||
@AutoConfigureBefore(FeignAutoConfiguration.class)
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class FeignConfig {
|
||||
|
||||
@Bean
|
||||
public RequestInterceptor requestInterceptor() {
|
||||
return requestTemplate -> {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if (null != attributes) {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
log.info("Feign request: {}", request.getRequestURI());
|
||||
// 将token信息放入header中
|
||||
String token = request.getHeader(CommonConstant.X_ACCESS_TOKEN);
|
||||
if(token==null){
|
||||
token = request.getParameter("token");
|
||||
}
|
||||
log.info("Feign request token: {}", token);
|
||||
requestTemplate.header(CommonConstant.X_ACCESS_TOKEN, token);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Feign 客户端的日志记录,默认级别为NONE
|
||||
* Logger.Level 的具体级别如下:
|
||||
* NONE:不记录任何信息
|
||||
* BASIC:仅记录请求方法、URL以及响应状态码和执行时间
|
||||
* HEADERS:除了记录 BASIC级别的信息外,还会记录请求和响应的头信息
|
||||
* FULL:记录所有请求与响应的明细,包括头信息、请求体、元数据
|
||||
*/
|
||||
@Bean
|
||||
Logger.Level feignLoggerLevel() {
|
||||
return Logger.Level.FULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Feign支持文件上传
|
||||
* @param messageConverters
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
@Primary
|
||||
@Scope("prototype")
|
||||
public Encoder multipartFormEncoder(ObjectFactory<HttpMessageConverters> messageConverters) {
|
||||
return new SpringFormEncoder(new SpringEncoder(messageConverters));
|
||||
}
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
package org.jeecg.starter.cloud.config;
|
||||
|
||||
import feign.Client;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
|
||||
import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory;
|
||||
import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class PersonBeanConfiguration {
|
||||
|
||||
/**
|
||||
* 创建FeignClient
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public Client feignClient(CachingSpringLoadBalancerFactory cachingFactory,
|
||||
SpringClientFactory clientFactory) {
|
||||
return new LoadBalancerFeignClient(new Client.Default(null, null),
|
||||
cachingFactory, clientFactory);
|
||||
}
|
||||
}
|
||||
-6
@@ -1,6 +0,0 @@
|
||||
package org.jeecg.starter.cloud.feign;
|
||||
|
||||
public interface IJeecgFeignService {
|
||||
|
||||
<T> T newInstance(Class<T> apiType, String name);
|
||||
}
|
||||
-60
@@ -1,60 +0,0 @@
|
||||
package org.jeecg.starter.cloud.feign.impl;
|
||||
|
||||
import feign.*;
|
||||
import feign.codec.Decoder;
|
||||
import feign.codec.Encoder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.starter.cloud.feign.IJeecgFeignService;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
|
||||
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@ConditionalOnClass(Feign.class)
|
||||
@AutoConfigureBefore(FeignAutoConfiguration.class)
|
||||
@Import(FeignClientsConfiguration.class)
|
||||
public class JeecgFeignService implements IJeecgFeignService {
|
||||
|
||||
|
||||
//Feign 原生构造器
|
||||
Feign.Builder builder;
|
||||
|
||||
//创建构造器
|
||||
public JeecgFeignService(Decoder decoder, Encoder encoder, Client client, Contract contract) {
|
||||
this.builder = Feign.builder()
|
||||
.client(client)
|
||||
.encoder(encoder)
|
||||
.decoder(decoder)
|
||||
.contract(contract);
|
||||
|
||||
builder.requestInterceptor(requestTemplate -> {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if (null != attributes) {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
log.info("Feign request: {}", request.getRequestURI());
|
||||
// 将token信息放入header中
|
||||
String token = request.getHeader(CommonConstant.X_ACCESS_TOKEN);
|
||||
if(token==null){
|
||||
token = request.getParameter("token");
|
||||
}
|
||||
log.info("Feign request token: {}", token);
|
||||
requestTemplate.header(CommonConstant.X_ACCESS_TOKEN, token);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public <T> T newInstance(Class<T> clientClass, String serviceName) {
|
||||
return builder.target(clientClass, String.format("http://%s/", serviceName));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user