Commit af14582f authored by 杨锐's avatar 杨锐

修复@Bean低级问题。

parent 2d68647d
......@@ -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>
......
......@@ -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
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment