OpenFeign的httpclient测试

This commit is contained in:
XCZTH 2020-09-04 19:04:06 +08:00
parent 1d2a4c07fd
commit 5398a41803
5 changed files with 27 additions and 7 deletions

View File

@ -42,7 +42,6 @@
<swagger.version>2.9.2</swagger.version>
<swagger-annotations.version>1.5.21</swagger-annotations.version>
<swagger-models.version>1.5.21</swagger-models.version>
<feign-httpclient.version>10.8</feign-httpclient.version>
<redisson.version>3.12.5</redisson.version>
<nimbus-jose-jwt.version>8.16</nimbus-jose-jwt.version>
<minio.version>7.1.0</minio.version>
@ -107,7 +106,6 @@
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@ -20,6 +20,12 @@
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
<version>11.0</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
<version>11.0</version>
</dependency>
</dependencies>
</project>

View File

@ -20,7 +20,7 @@
<dependency>
<groupId>com.youlai</groupId>
<artifactId>youlai-admin-api</artifactId>
<version>${youlai-common.version}</version>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -1,18 +1,18 @@
package com.youlai.auth.controller;
import com.youlai.admin.api.dto.UserDTO;
import com.youlai.admin.api.service.UmsAdminService;
import com.youlai.auth.domain.Oauth2Token;
import com.youlai.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.provider.endpoint.TokenEndpoint;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
@ -50,4 +50,14 @@ public class AuthController {
.build();
return Result.success(oauth2Token);
}
@Autowired
private UmsAdminService umsAdminService;
@GetMapping("/loadUserByUsername")
public Result loadUserByUsername(){
UserDTO userDTO = umsAdminService.loadUserByUsername("admin");
return Result.success(userDTO);
}
}

View File

@ -12,6 +12,12 @@ spring:
file-extension: yaml
group: DEFAULT_GROUP
prefix: ${spring.application.name}
feign:
httpclient:
enabled: false
okhttp:
enabled: true
# 演示配置中心使用
rsa:
publicKey: 123456