mirror of
https://github.com/yanlongqi/jhinno-openapi-java-sdk.git
synced 2026-03-22 06:15:10 +08:00
fix(自动配置): SpringBoot的自动配置的优化
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jhinno-openapi-java-sdk</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Jhinno OpenAPI SDK for Java</name>
|
||||
<description>The Jhinno OpenAPI SDK for Java used for accessing Jhinno OpenApi Service</description>
|
||||
@@ -14,7 +14,7 @@
|
||||
<parent>
|
||||
<groupId>com.jhinno</groupId>
|
||||
<artifactId>jhinno-openapi-java-sdk-parent</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jhinno-openapi-sdk-spring-boot-starter</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<version>2.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>Jhinno OpenAPI SDK for Java SpringBoot Starter</name>
|
||||
<description>The Jhinno OpenAPI SDK for Java used for accessing Jhinno OpenApi Service</description>
|
||||
@@ -14,7 +14,7 @@
|
||||
<parent>
|
||||
<groupId>com.jhinno</groupId>
|
||||
<artifactId>jhinno-openapi-java-sdk-parent</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.0</version>
|
||||
</parent>
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<dependency>
|
||||
<groupId>com.jhinno</groupId>
|
||||
<artifactId>jhinno-openapi-java-sdk</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -12,9 +12,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* openapi执行器自动配置
|
||||
*
|
||||
@@ -29,25 +26,58 @@ public class JHOpenapiExecutionAutoconfigure {
|
||||
private final JHOpenapiProperties properties;
|
||||
private final JHApiClient client;
|
||||
|
||||
|
||||
public void init(JHApiExecution apiExecution) {
|
||||
apiExecution.setJhApiClient(client);
|
||||
apiExecution.setForceGetToken(properties.isForceGetToken());
|
||||
apiExecution.setAuthType(properties.getAuthType());
|
||||
apiExecution.setAccessKey(properties.getAccessKey());
|
||||
apiExecution.setAccessKeySecret(properties.getAccessKeySecret());
|
||||
apiExecution.setTokenTimeout(properties.getTokenTimeout());
|
||||
apiExecution.setTokenResidueTime(properties.getTokenResidueTime());
|
||||
apiExecution.setUsedServerTime(properties.isUsedServerTime());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public List<JHApiExecution> ApiExecution() {
|
||||
List<JHApiExecution> executions = new ArrayList<>();
|
||||
executions.add(new JHAppApiExecution());
|
||||
executions.add(new JHDataApiExecution());
|
||||
executions.add(new JHFileApiExecution());
|
||||
executions.add(new JHJobApiExecution());
|
||||
executions.add(new JHDepartmentApiExecution());
|
||||
executions.add(new JHUserApiExecution());
|
||||
executions.forEach(t -> {
|
||||
t.setJhApiClient(client);
|
||||
t.setForceGetToken(properties.isForceGetToken());
|
||||
t.setAuthType(properties.getAuthType());
|
||||
t.setAccessKey(properties.getAccessKey());
|
||||
t.setAccessKeySecret(properties.getAccessKeySecret());
|
||||
t.setTokenTimeout(properties.getTokenTimeout());
|
||||
t.setTokenResidueTime(properties.getTokenResidueTime());
|
||||
t.setUsedServerTime(properties.isUsedServerTime());
|
||||
});
|
||||
return executions;
|
||||
public JHAppApiExecution appApiExecution() {
|
||||
JHAppApiExecution jhAppApiExecution = new JHAppApiExecution();
|
||||
init(jhAppApiExecution);
|
||||
return jhAppApiExecution;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JHDataApiExecution dataApiExecution() {
|
||||
JHDataApiExecution dataApiExecution = new JHDataApiExecution();
|
||||
init(dataApiExecution);
|
||||
return dataApiExecution;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public JHFileApiExecution fileApiExecution() {
|
||||
JHFileApiExecution fileApiExecution = new JHFileApiExecution();
|
||||
init(fileApiExecution);
|
||||
return fileApiExecution;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JHJobApiExecution jobApiExecution() {
|
||||
JHJobApiExecution jobApiExecution = new JHJobApiExecution();
|
||||
init(jobApiExecution);
|
||||
return jobApiExecution;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JHDepartmentApiExecution departmentApiExecution() {
|
||||
JHDepartmentApiExecution departmentApiExecution = new JHDepartmentApiExecution();
|
||||
init(departmentApiExecution);
|
||||
return departmentApiExecution;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JHUserApiExecution userApiExecution() {
|
||||
JHUserApiExecution userApiExecution = new JHUserApiExecution();
|
||||
init(userApiExecution);
|
||||
return userApiExecution;
|
||||
}
|
||||
}
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.jhinno</groupId>
|
||||
<artifactId>jhinno-openapi-java-sdk-parent</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.0.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Jhinno OpenAPI SDK for Java parent</name>
|
||||
<description>The Jhinno OpenAPI SDK for Java used for accessing Jhinno OpenApi Service</description>
|
||||
|
||||
Reference in New Issue
Block a user