Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cms_sys
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
西魏
cms_sys
Commits
43f7134d
Commit
43f7134d
authored
Jan 16, 2019
by
ms-dev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置更新
parent
c0972c6c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
SwaggerApiSuffixAspect.java
src/main/java/net/mingsoft/SwaggerApiSuffixAspect.java
+42
-0
SwaggerConfig.java
src/main/java/net/mingsoft/config/SwaggerConfig.java
+1
-1
No files found.
src/main/java/net/mingsoft/SwaggerApiSuffixAspect.java
0 → 100644
View file @
43f7134d
package
net
.
mingsoft
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Map
;
import
org.aspectj.lang.annotation.AfterReturning
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.stereotype.Component
;
import
io.swagger.models.Path
;
import
io.swagger.models.Swagger
;
/**
* 将接口url中追加模式后缀.do
* @author impler
* @date 2017年9月30日
*/
@Aspect
@EnableAspectJAutoProxy
@Component
public
class
SwaggerApiSuffixAspect
{
@AfterReturning
(
pointcut
=
"execution(public io.swagger.models.Swagger springfox.documentation.swagger2.mappers.ServiceModelToSwagger2MapperImpl.mapDocumentation(..))"
,
returning
=
"swagger"
)
public
void
doBeforeBussinessCheck
(
Swagger
swagger
){
Map
<
String
,
Path
>
paths
=
swagger
.
getPaths
();
if
(
null
!=
paths
){
Map
<
String
,
Path
>
newPaths
=
new
HashMap
<
String
,
Path
>(
paths
);
paths
.
clear
();
Iterator
<
String
>
it
=
newPaths
.
keySet
().
iterator
();
while
(
it
.
hasNext
()){
String
oldKey
=
it
.
next
();
// 添加模式后缀 .do
String
newKey
=
oldKey
+
".do"
;
paths
.
put
(
newKey
,
newPaths
.
get
(
oldKey
));
}
newPaths
=
null
;
}
}
}
src/main/java/net/mingsoft/config/SwaggerConfig.java
View file @
43f7134d
...
@@ -40,7 +40,7 @@ public class SwaggerConfig {
...
@@ -40,7 +40,7 @@ public class SwaggerConfig {
public
Docket
api
()
{
public
Docket
api
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
).
apiInfo
(
apiInfo
()).
select
()
return
new
Docket
(
DocumentationType
.
SWAGGER_2
).
apiInfo
(
apiInfo
()).
select
()
// 自行修改为自己的包路径
// 自行修改为自己的包路径
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"net.mingsoft
.*.action.web
"
)).
paths
(
PathSelectors
.
any
())
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"net.mingsoft"
)).
paths
(
PathSelectors
.
any
())
.
build
();
.
build
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment