Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
commons
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DevOps
commons
Commits
d55ba119
Commit
d55ba119
authored
May 08, 2018
by
技术部-高工-张恒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改common-spring的依赖和解决log冲突
parent
cab519aa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
26 deletions
+23
-26
pom.xml
brave-spring-boot-starter/pom.xml
+1
-17
BraveAutoConfiguration.java
...roup/tech/brave/configuration/BraveAutoConfiguration.java
+16
-4
pom.xml
commons-spring/pom.xml
+6
-5
No files found.
brave-spring-boot-starter/pom.xml
View file @
d55ba119
...
@@ -129,25 +129,9 @@
...
@@ -129,25 +129,9 @@
<dependency>
<dependency>
<groupId>
io.zipkin.brave
</groupId>
<groupId>
io.zipkin.brave
</groupId>
<artifactId>
brave-context-
log4j2
</artifactId>
<artifactId>
brave-context-
slf4j
</artifactId>
<version>
${brave.version}
</version>
<version>
${brave.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-core
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-jul
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-jcl
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-slf4j-impl
</artifactId>
</dependency>
</dependencies>
</dependencies>
...
...
brave-spring-boot-starter/src/main/java/cn/quantgroup/tech/brave/configuration/BraveAutoConfiguration.java
View file @
d55ba119
package
cn
.
quantgroup
.
tech
.
brave
.
configuration
;
package
cn
.
quantgroup
.
tech
.
brave
.
configuration
;
import
brave.Tracing
;
import
brave.Tracing
;
import
brave.context.
log4j2.ThreadContext
CurrentTraceContext
;
import
brave.context.
slf4j.MDC
CurrentTraceContext
;
import
brave.http.HttpTracing
;
import
brave.http.HttpTracing
;
import
brave.httpclient.TracingHttpClientBuilder
;
import
brave.httpclient.TracingHttpClientBuilder
;
import
brave.okhttp3.TracingInterceptor
;
import
brave.okhttp3.TracingInterceptor
;
...
@@ -24,6 +24,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
...
@@ -24,6 +24,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.AutoConfigureOrder
;
import
org.springframework.boot.autoconfigure.AutoConfigureOrder
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -71,11 +72,11 @@ public class BraveAutoConfiguration {
...
@@ -71,11 +72,11 @@ public class BraveAutoConfiguration {
}
}
@Configuration
@Configuration
@EnableConfigurationProperties
(
BraveProperties
.
class
)
@ConditionalOnProperty
(
prefix
=
"tech.brave"
,
name
=
"enabled"
,
havingValue
=
"false"
)
@ConditionalOnProperty
(
prefix
=
"tech.brave"
,
name
=
"enabled"
,
havingValue
=
"false"
)
public
static
class
BraveUntEnabled
{
public
static
class
BraveUntEnabled
{
@Configuration
@Configuration
@ConditionalOnClass
(
RabbitTemplate
.
class
)
@ConditionalOnClass
(
RabbitTemplate
.
class
)
@ConditionalOnProperty
(
prefix
=
"tech.brave"
,
name
=
"enabled"
,
havingValue
=
"false"
)
public
static
class
RabbitTemplateEnable
{
public
static
class
RabbitTemplateEnable
{
/**
/**
* 提供RabbitTemplateBuilder,业务系统需要使用该Builder生成RabbitTemplate
* 提供RabbitTemplateBuilder,业务系统需要使用该Builder生成RabbitTemplate
...
@@ -90,6 +91,7 @@ public class BraveAutoConfiguration {
...
@@ -90,6 +91,7 @@ public class BraveAutoConfiguration {
@Configuration
@Configuration
@ConditionalOnClass
(
HttpClient
.
class
)
@ConditionalOnClass
(
HttpClient
.
class
)
@ConditionalOnProperty
(
prefix
=
"tech.brave"
,
name
=
"enabled"
,
havingValue
=
"false"
)
public
static
class
HttpClientEnable
{
public
static
class
HttpClientEnable
{
/**
/**
* 提供HttpClientBuilderBean
* 提供HttpClientBuilderBean
...
@@ -99,12 +101,13 @@ public class BraveAutoConfiguration {
...
@@ -99,12 +101,13 @@ public class BraveAutoConfiguration {
@Bean
(
name
=
"techHttpClientBuilder"
)
@Bean
(
name
=
"techHttpClientBuilder"
)
public
HttpClientBuilder
httpClientBuilder
()
{
public
HttpClientBuilder
httpClientBuilder
()
{
log
.
info
(
"注册HttpClientBuilder"
);
log
.
info
(
"注册HttpClientBuilder"
);
return
Tracing
HttpClientBuilder
.
create
();
return
HttpClientBuilder
.
create
();
}
}
}
}
@Configuration
@Configuration
@ConditionalOnClass
(
OkHttpClient
.
class
)
@ConditionalOnClass
(
OkHttpClient
.
class
)
@ConditionalOnProperty
(
prefix
=
"tech.brave"
,
name
=
"enabled"
,
havingValue
=
"false"
)
public
static
class
OkHttpClientEnable
{
public
static
class
OkHttpClientEnable
{
/**
/**
...
@@ -121,6 +124,7 @@ public class BraveAutoConfiguration {
...
@@ -121,6 +124,7 @@ public class BraveAutoConfiguration {
@Configuration
@Configuration
@ConditionalOnClass
(
RestTemplate
.
class
)
@ConditionalOnClass
(
RestTemplate
.
class
)
@ConditionalOnProperty
(
prefix
=
"tech.brave"
,
name
=
"enabled"
,
havingValue
=
"false"
)
public
static
class
RestTemplateEnable
{
public
static
class
RestTemplateEnable
{
/**
/**
* 提供RestTemplate
* 提供RestTemplate
...
@@ -153,26 +157,30 @@ public class BraveAutoConfiguration {
...
@@ -153,26 +157,30 @@ public class BraveAutoConfiguration {
private
SpanCustomizingAsyncHandlerInterceptor
spanCustomizingAsyncHandlerInterceptor
;
private
SpanCustomizingAsyncHandlerInterceptor
spanCustomizingAsyncHandlerInterceptor
;
@Bean
@Bean
@ConditionalOnMissingBean
Sender
sender
()
{
Sender
sender
()
{
return
KafkaSender
.
newBuilder
().
bootstrapServers
(
braveProperties
.
getKafkaBootstrapServers
()).
topic
(
braveProperties
.
getKafkaTopic
()).
encoding
(
Encoding
.
JSON
).
build
();
return
KafkaSender
.
newBuilder
().
bootstrapServers
(
braveProperties
.
getKafkaBootstrapServers
()).
topic
(
braveProperties
.
getKafkaTopic
()).
encoding
(
Encoding
.
JSON
).
build
();
}
}
@Bean
@Bean
@ConditionalOnMissingBean
AsyncReporter
<
Span
>
spanReporter
()
{
AsyncReporter
<
Span
>
spanReporter
()
{
return
AsyncReporter
.
create
(
sender
());
return
AsyncReporter
.
create
(
sender
());
}
}
@Bean
@Bean
@ConditionalOnMissingBean
Tracing
tracing
()
{
Tracing
tracing
()
{
return
Tracing
.
newBuilder
()
return
Tracing
.
newBuilder
()
.
sampler
(
brave
.
sampler
.
Sampler
.
create
(
braveProperties
.
getSample
()))
.
sampler
(
brave
.
sampler
.
Sampler
.
create
(
braveProperties
.
getSample
()))
.
localServiceName
(
serviceProperties
.
getName
())
.
localServiceName
(
serviceProperties
.
getName
())
.
propagationFactory
(
ExtraFieldPropagation
.
newFactory
(
B3Propagation
.
FACTORY
,
"user-name"
))
.
propagationFactory
(
ExtraFieldPropagation
.
newFactory
(
B3Propagation
.
FACTORY
,
"user-name"
))
.
currentTraceContext
(
ThreadContext
CurrentTraceContext
.
create
())
.
currentTraceContext
(
MDC
CurrentTraceContext
.
create
())
.
spanReporter
(
spanReporter
()).
build
();
.
spanReporter
(
spanReporter
()).
build
();
}
}
@Bean
@Bean
@ConditionalOnMissingBean
public
HttpTracing
httpTracing
(
Tracing
tracing
)
{
public
HttpTracing
httpTracing
(
Tracing
tracing
)
{
return
HttpTracing
.
create
(
tracing
);
return
HttpTracing
.
create
(
tracing
);
}
}
...
@@ -196,6 +204,7 @@ public class BraveAutoConfiguration {
...
@@ -196,6 +204,7 @@ public class BraveAutoConfiguration {
@Configuration
@Configuration
@ConditionalOnClass
(
RabbitTemplate
.
class
)
@ConditionalOnClass
(
RabbitTemplate
.
class
)
@ConditionalOnProperty
(
prefix
=
"tech.brave"
,
name
=
"enabled"
,
havingValue
=
"true"
)
public
static
class
RabbitTemplateEnable
{
public
static
class
RabbitTemplateEnable
{
/**
/**
* 提供RabbitTemplateBuilder,业务系统需要使用该Builder生成RabbitTemplate
* 提供RabbitTemplateBuilder,业务系统需要使用该Builder生成RabbitTemplate
...
@@ -211,6 +220,7 @@ public class BraveAutoConfiguration {
...
@@ -211,6 +220,7 @@ public class BraveAutoConfiguration {
@Configuration
@Configuration
@ConditionalOnClass
(
HttpClient
.
class
)
@ConditionalOnClass
(
HttpClient
.
class
)
@ConditionalOnProperty
(
prefix
=
"tech.brave"
,
name
=
"enabled"
,
havingValue
=
"true"
)
public
static
class
HttpClientEnable
{
public
static
class
HttpClientEnable
{
/**
/**
* 提供HttpClientBuilderBean
* 提供HttpClientBuilderBean
...
@@ -227,6 +237,7 @@ public class BraveAutoConfiguration {
...
@@ -227,6 +237,7 @@ public class BraveAutoConfiguration {
@Configuration
@Configuration
@ConditionalOnClass
(
OkHttpClient
.
class
)
@ConditionalOnClass
(
OkHttpClient
.
class
)
@ConditionalOnProperty
(
prefix
=
"tech.brave"
,
name
=
"enabled"
,
havingValue
=
"true"
)
public
static
class
OkHttpClientEnable
{
public
static
class
OkHttpClientEnable
{
/**
/**
* 提供OkHttpClientBean
* 提供OkHttpClientBean
...
@@ -246,6 +257,7 @@ public class BraveAutoConfiguration {
...
@@ -246,6 +257,7 @@ public class BraveAutoConfiguration {
@Configuration
@Configuration
@ConditionalOnClass
(
RestTemplate
.
class
)
@ConditionalOnClass
(
RestTemplate
.
class
)
@ConditionalOnProperty
(
prefix
=
"tech.brave"
,
name
=
"enabled"
,
havingValue
=
"true"
)
@Import
(
TracingClientHttpRequestInterceptor
.
class
)
@Import
(
TracingClientHttpRequestInterceptor
.
class
)
public
static
class
RestTemplateEnable
{
public
static
class
RestTemplateEnable
{
@Autowired
@Autowired
...
...
commons-spring/pom.xml
View file @
d55ba119
...
@@ -90,18 +90,19 @@
...
@@ -90,18 +90,19 @@
<artifactId>
lombok
</artifactId>
<artifactId>
lombok
</artifactId>
<version>
1.16.16
</version>
<version>
1.16.16
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
<scope>
test
</scope>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.assertj
</groupId>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
assertj-core
</artifactId>
<artifactId>
spring-cloud-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-aop
</artifactId>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-jdbc
</artifactId>
<artifactId>
spring-jdbc
</artifactId>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment