Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
nzwz
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
inroi
nzwz
Commits
fd648f2e
提交
fd648f2e
authored
6月 20, 2022
作者:
inroi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
微调
上级
8aa58d67
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
13 行增加
和
18 行删除
+13
-18
SwaggerConfig.java
...rc/main/java/com/framework/core/config/SwaggerConfig.java
+10
-16
WebMvcConfig.java
...os-system/src/main/java/com/nzwz/config/WebMvcConfig.java
+2
-1
application-test.yml
starbos-system/src/main/resources/application-test.yml
+1
-1
没有找到文件。
starbos-framework/starbos-framework-core/src/main/java/com/framework/core/config/SwaggerConfig.java
浏览文件 @
fd648f2e
package
com
.
framework
.
core
.
config
;
//import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import
com.framework.core.constant.CommonConstant
;
import
com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.EnableWebMvc
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.ParameterBuilder
;
import
springfox.documentation.builders.PathSelectors
;
...
...
@@ -27,7 +28,7 @@ import java.util.List;
@Configuration
@EnableSwagger2
//@ConditionalOnProperty(name = "swagger.enabled", havingValue = "true")
public
class
SwaggerConfig
extends
WebMvcConfigurationSupport
{
public
class
SwaggerConfig
implements
WebMvcConfigurer
{
//api接口包扫描路径
public
static
final
String
SWAGGER_SCAN_BASE_PACKAGE
=
"com"
;
@Value
(
"${spring.application.name}"
)
...
...
@@ -113,7 +114,7 @@ public class SwaggerConfig extends WebMvcConfigurationSupport {
.
version
(
"1.0"
)
// .termsOfServiceUrl("NO terms of service")
// 描述
.
description
(
applicationName
+
"后台API接口"
)
.
description
(
applicationName
+
"后台API接口"
)
// 作者
// .contact("")
.
license
(
"The Apache License, Version 2.0"
)
...
...
@@ -123,21 +124,14 @@ public class SwaggerConfig extends WebMvcConfigurationSupport {
/**
* 防止@EnableMvc把默认的静态资源路径覆盖了,手动设置的方式
*
* @param registry
*/
@Override
protected
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
// 解决静态资源无法访问
registry
.
addResourceHandler
(
"/**"
)
.
addResourceLocations
(
"classpath:/static/"
);
// 解决swagger无法访问
registry
.
addResourceHandler
(
"/swagger-ui.html"
)
.
addResourceLocations
(
"classpath:/META-INF/resources/"
);
// 解决swagger的js文件无法访问
registry
.
addResourceHandler
(
"/webjars/**"
)
.
addResourceLocations
(
"classpath:/META-INF/resources/webjars/"
);
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
registry
.
addResourceHandler
(
"swagger-ui.html"
).
addResourceLocations
(
"classpath:/META-INF/resources/"
);
registry
.
addResourceHandler
(
"doc.html"
).
addResourceLocations
(
"classpath:/META-INF/resources/"
);
registry
.
addResourceHandler
(
"/webjars/**"
).
addResourceLocations
(
"classpath:/META-INF/resources/webjars/"
);
}
}
starbos-system/src/main/java/com/nzwz/config/WebMvcConfig.java
浏览文件 @
fd648f2e
...
...
@@ -21,8 +21,9 @@ import java.util.List;
/**
* @author Inori
*/
@EnableWebMvc
@Configuration
public
class
WebMvcConfig
extends
WebMvcConfigurationSupport
{
public
class
WebMvcConfig
implements
WebMvcConfigurer
{
@Override
public
void
extendMessageConverters
(
List
<
HttpMessageConverter
<?>>
converters
)
{
...
...
starbos-system/src/main/resources/application-test.yml
浏览文件 @
fd648f2e
...
...
@@ -80,7 +80,7 @@ security:
client-id
:
user-client
client-secret
:
user-secret-8888
# user-authorization-uri: http://127.0.0.7:${server.port}/oauth/authorize
access-token-uri
:
http://localhost:${server.port}/oauth/token
access-token-uri
:
http://localhost:${server.port}/
nzwz/
oauth/token
resource
:
jwt
:
#key-uri: http://starbos-auth-system:6001/oauth/token_key
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论