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
af14582f
Commit
af14582f
authored
Mar 10, 2020
by
杨锐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复@Bean低级问题。
parent
2d68647d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
61 additions
and
27 deletions
+61
-27
pom.xml
brave-spring-boot-starter/pom.xml
+1
-1
AuthAutoConfiguration.java
...group/tech/brave/configuration/AuthAutoConfiguration.java
+52
-18
pom.xml
commons-core/pom.xml
+1
-1
pom.xml
commons-spring/pom.xml
+1
-1
pom.xml
elastic-job-lite-spring-boot-starter/pom.xml
+1
-1
pom.xml
enoch-agent-spring-boot-starter/pom.xml
+1
-1
pom.xml
idgenerator-spring-boot-starter/pom.xml
+1
-1
pom.xml
pom.xml
+2
-2
pom.xml
shutdown-spring-boot-starter/pom.xml
+1
-1
No files found.
brave-spring-boot-starter/pom.xml
View file @
af14582f
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.3.
1
</version>
<version>
0.3.
2
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
brave-spring-boot-starter/src/main/java/cn/quantgroup/tech/brave/configuration/AuthAutoConfiguration.java
View file @
af14582f
...
...
@@ -3,10 +3,14 @@ package cn.quantgroup.tech.brave.configuration;
import
cn.quantgroup.tech.brave.interceptor.*
;
import
cn.quantgroup.tech.brave.interceptor.impl.*
;
import
cn.quantgroup.tech.brave.job.TokenJob
;
import
okhttp3.Interceptor
;
import
org.apache.http.HttpRequestInterceptor
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.client.ClientHttpRequestInterceptor
;
@Configuration
public
class
AuthAutoConfiguration
{
...
...
@@ -14,22 +18,37 @@ public class AuthAutoConfiguration {
@Configuration
public
static
class
NoAuthConfiguration
{
@Bean
@Configuration
@ConditionalOnClass
(
HttpRequestInterceptor
.
class
)
@ConditionalOnMissingBean
(
HttpClientRequestInterceptor
.
class
)
public
HttpClientRequestInterceptor
httpClientRequestInterceptor
()
{
return
new
HttpClientNoAuthRequestInterceptor
();
public
static
class
HttpRequestInterceptorEnable
{
@Bean
public
HttpClientRequestInterceptor
httpClientRequestInterceptor
()
{
return
new
HttpClientNoAuthRequestInterceptor
();
}
}
@Bean
@Configuration
@ConditionalOnClass
(
Interceptor
.
class
)
@ConditionalOnMissingBean
(
OkHttpClientInterceptor
.
class
)
public
OkHttpClientInterceptor
okHttpClientInterceptor
()
{
return
new
OkHttpClientNoAuthInterceptor
();
public
static
class
InterceptorEnable
{
@Bean
public
OkHttpClientInterceptor
okHttpClientInterceptor
()
{
return
new
OkHttpClientNoAuthInterceptor
();
}
}
@Bean
@Configuration
@ConditionalOnClass
(
ClientHttpRequestInterceptor
.
class
)
@ConditionalOnMissingBean
(
RestTemplateRequestInterceptor
.
class
)
public
RestTemplateRequestInterceptor
restTemplateRequestInterceptor
()
{
return
new
RestTemplateNoAuthRequestInterceptor
();
public
static
class
ClientHttpRequestInterceptorEnable
{
@Bean
public
RestTemplateRequestInterceptor
restTemplateRequestInterceptor
()
{
return
new
RestTemplateNoAuthRequestInterceptor
();
}
}
}
...
...
@@ -37,22 +56,37 @@ public class AuthAutoConfiguration {
@ConditionalOnProperty
(
prefix
=
"tech.auth"
,
name
=
"enabled"
,
havingValue
=
"true"
)
public
static
class
AuthConfiguration
{
@Bean
@Configuration
@ConditionalOnClass
(
HttpRequestInterceptor
.
class
)
@ConditionalOnProperty
(
prefix
=
"tech.auth"
,
name
=
{
"http"
,
"clientId"
,
"secret"
,
"tokenUrl"
})
public
HttpClientRequestInterceptor
httpClientRequestInterceptor
()
{
return
new
HttpClientAuthRequestInterceptor
();
public
static
class
HttpRequestInterceptorEnable
{
@Bean
public
HttpClientRequestInterceptor
httpClientRequestInterceptor
()
{
return
new
HttpClientAuthRequestInterceptor
();
}
}
@Bean
@Configuration
@ConditionalOnClass
(
Interceptor
.
class
)
@ConditionalOnProperty
(
prefix
=
"tech.auth"
,
name
=
{
"http"
,
"clientId"
,
"secret"
,
"tokenUrl"
})
public
OkHttpClientInterceptor
okHttpClientInterceptor
()
{
return
new
OkHttpClientAuthInterceptor
();
public
static
class
InterceptorEnable
{
@Bean
public
OkHttpClientInterceptor
okHttpClientInterceptor
()
{
return
new
OkHttpClientAuthInterceptor
();
}
}
@Bean
@Configuration
@ConditionalOnClass
(
ClientHttpRequestInterceptor
.
class
)
@ConditionalOnProperty
(
prefix
=
"tech.auth"
,
name
=
{
"http"
,
"clientId"
,
"secret"
,
"tokenUrl"
})
public
RestTemplateRequestInterceptor
restTemplateRequestInterceptor
()
{
return
new
RestTemplateAuthRequestInterceptor
();
public
static
class
ClientHttpRequestInterceptorEnable
{
@Bean
public
RestTemplateRequestInterceptor
restTemplateRequestInterceptor
()
{
return
new
RestTemplateAuthRequestInterceptor
();
}
}
@Bean
...
...
commons-core/pom.xml
View file @
af14582f
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.3.
1
</version>
<version>
0.3.
2
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
commons-spring/pom.xml
View file @
af14582f
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.3.
1
</version>
<version>
0.3.
2
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
elastic-job-lite-spring-boot-starter/pom.xml
View file @
af14582f
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.3.
1
</version>
<version>
0.3.
2
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
enoch-agent-spring-boot-starter/pom.xml
View file @
af14582f
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.3.
1
</version>
<version>
0.3.
2
</version>
</parent>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
enoch-agent-spring-boot-starter
</artifactId>
...
...
idgenerator-spring-boot-starter/pom.xml
View file @
af14582f
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.3.
1
</version>
<version>
0.3.
2
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
pom.xml
View file @
af14582f
...
...
@@ -6,7 +6,7 @@
<modelVersion>
4.0.0
</modelVersion>
<groupId>
cn.quantgroup
</groupId>
<artifactId>
commons-parent
</artifactId>
<version>
0.3.
1
</version>
<version>
0.3.
2
</version>
<parent>
<groupId>
org.springframework.boot
</groupId>
...
...
@@ -35,7 +35,7 @@
<lombok.version>
1.16.20
</lombok.version>
<guava.version>
23.0
</guava.version>
<apollo.client.version>
0.10.2
</apollo.client.version>
<common.parent.version>
0.3.
1
</common.parent.version>
<common.parent.version>
0.3.
2
</common.parent.version>
</properties>
<dependencies>
...
...
shutdown-spring-boot-starter/pom.xml
View file @
af14582f
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
commons-parent
</artifactId>
<groupId>
cn.quantgroup
</groupId>
<version>
0.3.
1
</version>
<version>
0.3.
2
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
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