项目整合knife4j

This commit is contained in:
XCZTH 2020-09-03 19:48:06 +08:00
parent 4e5c1719a1
commit 1d2a4c07fd
5 changed files with 27 additions and 31 deletions

15
pom.xml
View File

@ -46,6 +46,7 @@
<redisson.version>3.12.5</redisson.version>
<nimbus-jose-jwt.version>8.16</nimbus-jose-jwt.version>
<minio.version>7.1.0</minio.version>
<knife4j.version>2.0.4</knife4j.version>
</properties>
<dependencies>
@ -93,6 +94,20 @@
<artifactId>nimbus-jose-jwt</artifactId>
<version>${nimbus-jose-jwt.version}</version>
</dependency>
<!--Knife4j API文档-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-micro-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@ -32,11 +32,9 @@ import java.util.stream.Collectors;
@AllArgsConstructor
public class SysUserController {
private ISysUserService iSysUserService;
private ISysUserRoleService iSysUserRoleService;
private ISysRoleService iSysRoleService;
private final ISysUserService iSysUserService;
private final ISysUserRoleService iSysUserRoleService;
private final ISysRoleService iSysRoleService;
@ApiOperation(value = "列表分页", httpMethod = "GET")
@ApiImplicitParams({

View File

@ -7,9 +7,12 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
@Slf4j
@Component
@ -52,6 +55,7 @@ public class MinIOService implements InitializingBean {
PutObjectArgs putObjectArgs = PutObjectArgs.builder()
.bucket(bucketName)
.object(objectName)
.contentType(MediaType.IMAGE_JPEG_VALUE)
.stream(inputStream, inputStream.available(), -1)
.build();
client.putObject(putObjectArgs);

View File

@ -1,5 +1,5 @@
server:
port: 8808
port: 8080
spring:
application:

View File

@ -1,19 +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.beans.factory.annotation.Value;
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.*;
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 springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
@ -51,24 +50,4 @@ public class AuthController {
.build();
return Result.success(oauth2Token);
}
@Value("${rsa.publicKey}")
public String publicKey;
@GetMapping("/publicKey")
public Result getPublicKey(){
return Result.success(this.publicKey);
}
@Autowired
private UmsAdminService umsAdminService;
@GetMapping("/loadUserByUsername")
public Result loadUserByUsername(){
UserDTO userDTO = umsAdminService.loadUserByUsername("admin");
return Result.success(userDTO);
}
}