parent
641a2e8d96
commit
b007381a2c
|
@ -7,10 +7,23 @@ import io.swagger.v3.oas.models.Components;
|
||||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@Configuration
|
@Configuration
|
||||||
public class SwaggerConfig {
|
public class SwaggerConfig {
|
||||||
|
|
||||||
|
@Value("${server.port}")
|
||||||
|
private String serverPort;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
log.info("Swagger UI: http://localhost:{}/swagger-ui.html", serverPort);
|
||||||
|
log.info("OpenAPI JSON: http://localhost:{}/v3/api-docs", serverPort);
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public OpenAPI springShopOpenAPI() {
|
public OpenAPI springShopOpenAPI() {
|
||||||
return new OpenAPI()
|
return new OpenAPI()
|
||||||
|
|
|
@ -16,7 +16,12 @@ public class SecurityConstants {
|
||||||
"/api/user/register", // 用户注册
|
"/api/user/register", // 用户注册
|
||||||
"/api/user/login", // 用户登录
|
"/api/user/login", // 用户登录
|
||||||
"/api/user/getEmailCode", // 获取邮箱验证码
|
"/api/user/getEmailCode", // 获取邮箱验证码
|
||||||
"/api/user/getPhoneCode" // 获取手机验证码
|
"/api/user/getPhoneCode", // 获取手机验证码
|
||||||
|
"/v3/api-docs/**", // Swagger API文档
|
||||||
|
"/swagger-ui/**", // Swagger UI
|
||||||
|
"/swagger-ui.html", // Swagger UI HTML
|
||||||
|
"/swagger-resources/**", // Swagger 资源
|
||||||
|
"/webjars/**" // Swagger UI 相关资源
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -103,8 +103,12 @@ springdoc:
|
||||||
path: /swagger-ui.html
|
path: /swagger-ui.html
|
||||||
tags-sorter: alpha
|
tags-sorter: alpha
|
||||||
operations-sorter: alpha
|
operations-sorter: alpha
|
||||||
|
enabled: true
|
||||||
|
disable-swagger-default-url: true
|
||||||
api-docs:
|
api-docs:
|
||||||
path: /v3/api-docs
|
path: /v3/api-docs
|
||||||
|
enabled: true
|
||||||
group-configs:
|
group-configs:
|
||||||
- group: '默认'
|
- group: '默认'
|
||||||
paths-to-match: '/**'
|
paths-to-match: '/**'
|
||||||
|
packages-to-scan: com.guwan.backend.controller
|
Loading…
Reference in New Issue