parent
d640f8a285
commit
cef8d8f42f
|
|
@ -14,11 +14,6 @@ package com.chushang.common.feign.annotation;/*
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import com.chushang.common.feign.interceptor.FeignHeaderInterceptor;
|
|
||||||
import com.chushang.common.feign.interceptor.MdcInterceptor;
|
|
||||||
import com.chushang.common.feign.registrar.MdcFilterRegistrar;
|
|
||||||
import com.chushang.common.feign.registrar.TransferFeginFilterRegistrar;
|
|
||||||
import com.chushang.common.feign.registrar.TransferFilterRegistrar;
|
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
|
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
|
||||||
import org.springframework.cloud.openfeign.ChushangFeignClientsRegistrar;
|
import org.springframework.cloud.openfeign.ChushangFeignClientsRegistrar;
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,16 @@ package com.chushang.common.feign.interceptor;
|
||||||
import com.chushang.common.core.constant.CommonConstants;
|
import com.chushang.common.core.constant.CommonConstants;
|
||||||
import feign.RequestInterceptor;
|
import feign.RequestInterceptor;
|
||||||
import feign.RequestTemplate;
|
import feign.RequestTemplate;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.MDC;
|
import org.slf4j.MDC;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
public class MdcInterceptor implements RequestInterceptor {
|
public class MdcInterceptor implements RequestInterceptor {
|
||||||
public MdcInterceptor() {
|
public MdcInterceptor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void apply(RequestTemplate template) {
|
public void apply(RequestTemplate template) {
|
||||||
|
log.info("TRACE_ID : -------- {}", MDC.get(CommonConstants.TRACE_ID));
|
||||||
template.header(CommonConstants.TRACE_ID, MDC.get(CommonConstants.TRACE_ID));
|
template.header(CommonConstants.TRACE_ID, MDC.get(CommonConstants.TRACE_ID));
|
||||||
template.header(CommonConstants.SPAN, MDC.get(CommonConstants.SPAN));
|
template.header(CommonConstants.SPAN, MDC.get(CommonConstants.SPAN));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.chushang;
|
||||||
|
|
||||||
import com.chushang.common.core.enums.AppStartType;
|
import com.chushang.common.core.enums.AppStartType;
|
||||||
import com.chushang.common.feign.annotation.EnableOnnFeignClients;
|
import com.chushang.common.feign.annotation.EnableOnnFeignClients;
|
||||||
|
import com.chushang.common.feign.annotation.EnableTransferFeign;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
|
|
@ -21,6 +22,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
@EnableOnnFeignClients
|
@EnableOnnFeignClients
|
||||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
|
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
|
||||||
@ServletComponentScan
|
@ServletComponentScan
|
||||||
|
@EnableTransferFeign
|
||||||
public class AuthApplication extends SpringBootServletInitializer
|
public class AuthApplication extends SpringBootServletInitializer
|
||||||
{
|
{
|
||||||
private final static Logger log = LoggerFactory.getLogger(AuthApplication.class);
|
private final static Logger log = LoggerFactory.getLogger(AuthApplication.class);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
<property name="log.env" value="${plumelog.env}"/>
|
<property name="log.env" value="${plumelog.env}"/>
|
||||||
|
|
||||||
<!-- 彩色日志格式 -->
|
<!-- 彩色日志格式 -->
|
||||||
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} TRACE[%X{trace:-}/%X{span:-}] [%clr(%5p) %clr(${PID:- } %clr(%15.15t){faint}] %clr(---){faint}){magenta} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx"/>
|
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} TRACE[%X{traceId:-} / %X{span:-}] [%clr(%5p) %clr(${PID:- } %clr(%15.15t){faint}] %clr(---){faint}){magenta} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx"/>
|
||||||
<!-- 彩色日志依赖的渲染类 -->
|
<!-- 彩色日志依赖的渲染类 -->
|
||||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||||
<conversionRule conversionWord="wex"
|
<conversionRule conversionWord="wex"
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
<property name="log.env" value="${plumelog.env}"/>
|
<property name="log.env" value="${plumelog.env}"/>
|
||||||
|
|
||||||
<!-- 彩色日志格式 -->
|
<!-- 彩色日志格式 -->
|
||||||
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} TRACE[%X{trace:-}/%X{span:-}] [%clr(%5p) %clr(${PID:- } %clr(%15.15t){faint}] %clr(---){faint}){magenta} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx"/>
|
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} TRACE[%X{trace:-} / %X{span:-}] [%clr(%5p) %clr(${PID:- } %clr(%15.15t){faint}] %clr(---){faint}){magenta} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx"/>
|
||||||
<!-- 彩色日志依赖的渲染类 -->
|
<!-- 彩色日志依赖的渲染类 -->
|
||||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||||
<conversionRule conversionWord="wex"
|
<conversionRule conversionWord="wex"
|
||||||
|
|
@ -100,7 +100,7 @@
|
||||||
<!-- </appender>-->
|
<!-- </appender>-->
|
||||||
|
|
||||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||||
<root level="info">
|
<root level="debug">
|
||||||
<appender-ref ref="console"/>
|
<appender-ref ref="console"/>
|
||||||
<appender-ref ref="info"/>
|
<appender-ref ref="info"/>
|
||||||
<appender-ref ref="debug"/>
|
<appender-ref ref="debug"/>
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,12 @@ package com.chushang.oss;
|
||||||
|
|
||||||
import com.chushang.common.core.enums.AppStartType;
|
import com.chushang.common.core.enums.AppStartType;
|
||||||
import com.chushang.common.feign.annotation.EnableOnnFeignClients;
|
import com.chushang.common.feign.annotation.EnableOnnFeignClients;
|
||||||
import com.chushang.common.feign.annotation.EnableTransferFeign;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
||||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @auther: zhao
|
* @auther: zhao
|
||||||
* @date: 2024/4/29 10:50
|
* @date: 2024/4/29 10:50
|
||||||
|
|
@ -19,7 +15,7 @@ import javax.sql.DataSource;
|
||||||
@EnableDiscoveryClient
|
@EnableDiscoveryClient
|
||||||
@EnableOnnFeignClients
|
@EnableOnnFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableTransferFeign
|
//@EnableTransferFeign
|
||||||
public class OssApplication {
|
public class OssApplication {
|
||||||
|
|
||||||
private final static Logger log = LoggerFactory.getLogger(OssApplication.class);
|
private final static Logger log = LoggerFactory.getLogger(OssApplication.class);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
<property name="log.env" value="${plumelog.env}"/>
|
<property name="log.env" value="${plumelog.env}"/>
|
||||||
|
|
||||||
<!-- 彩色日志格式 -->
|
<!-- 彩色日志格式 -->
|
||||||
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} TRACE[%X{trace:-}/%X{span:-}] [%clr(%5p) %clr(${PID:- } %clr(%15.15t){faint}] %clr(---){faint}){magenta} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx"/>
|
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} TRACE[%X{traceId:-} / %X{span:-}] [%clr(%5p) %clr(${PID:- } %clr(%15.15t){faint}] %clr(---){faint}){magenta} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wEx"/>
|
||||||
<!-- 彩色日志依赖的渲染类 -->
|
<!-- 彩色日志依赖的渲染类 -->
|
||||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||||
<conversionRule conversionWord="wex"
|
<conversionRule conversionWord="wex"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
#spring settings
|
||||||
|
server:
|
||||||
|
servlet:
|
||||||
|
encoding:
|
||||||
|
force: true
|
||||||
|
charset: UTF-8
|
||||||
|
enabled: true
|
||||||
|
session:
|
||||||
|
cookie:
|
||||||
|
name: sentinel_dashboard_cookie
|
||||||
|
# #logging settings
|
||||||
|
#logging:
|
||||||
|
# file:
|
||||||
|
# name: ${user.home}/logs/csp/sentinel-dashboard.log
|
||||||
|
# pattern:
|
||||||
|
# file: %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
|
||||||
|
# level: info
|
||||||
|
auth:
|
||||||
|
filter:
|
||||||
|
exclude-urls: /,/auth/login,/auth/logout,/registry/machine,/version
|
||||||
|
exclude-url-suffixes: htm,html,js,css,map,ico,ttf,woff,png
|
||||||
|
username: sentinel
|
||||||
|
password: sentinel
|
||||||
|
# todo 需要配置mongo 数据源
|
||||||
|
|
@ -8,21 +8,24 @@ spring:
|
||||||
name: @artifactId@
|
name: @artifactId@
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
|
server-addr: ${nacos.host}
|
||||||
|
username: ${nacos.username}
|
||||||
|
password: ${nacos.password}
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: ${nacos.host}
|
server-addr: ${spring.cloud.nacos.server-addr}
|
||||||
namespace: ${nacos.namespace}
|
namespace: ${nacos.namespace}
|
||||||
group: ${nacos.group}
|
group: ${nacos.group}
|
||||||
|
service: ${spring.application.name}
|
||||||
config:
|
config:
|
||||||
|
server-addr: ${spring.cloud.nacos.server-addr}
|
||||||
namespace: ${spring.cloud.nacos.discovery.namespace}
|
namespace: ${spring.cloud.nacos.discovery.namespace}
|
||||||
group: ${spring.cloud.nacos.discovery.group}
|
group: ${spring.cloud.nacos.discovery.group}
|
||||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
file-extension: yaml
|
||||||
file-extension: yml
|
refresh-enabled: true
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- dataId: application-admin-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- dataId: application-common.${spring.cloud.nacos.config.file-extension}
|
||||||
group: COMMON_GROUP
|
group: ${nacos.group}
|
||||||
- dataId: application-log-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
refresh: ${spring.cloud.nacos.config.refresh-enabled}
|
||||||
group: COMMON_GROUP
|
|
||||||
refresh: true
|
|
||||||
profiles:
|
profiles:
|
||||||
active: @profiles.active@
|
active: @profiles.active@
|
||||||
sentinel:
|
sentinel:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue