Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
RuoYi Vue
Commits
5676cf9a
Commit
5676cf9a
authored
Feb 06, 2023
by
RuoYi
Browse files
修复匿名注解Anonymous空指针问题(I683DT)
parent
c3d0cd5f
Changes
1
Hide whitespace changes
Inline
Side-by-side
ruoyi-framework/src/main/java/com/ruoyi/framework/config/properties/PermitAllUrlProperties.java
View file @
5676cf9a
...
@@ -3,6 +3,7 @@ package com.ruoyi.framework.config.properties;
...
@@ -3,6 +3,7 @@ package com.ruoyi.framework.config.properties;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
import
org.apache.commons.lang3.RegExUtils
;
import
org.apache.commons.lang3.RegExUtils
;
...
@@ -44,12 +45,12 @@ public class PermitAllUrlProperties implements InitializingBean, ApplicationCont
...
@@ -44,12 +45,12 @@ public class PermitAllUrlProperties implements InitializingBean, ApplicationCont
// 获取方法上边的注解 替代path variable 为 *
// 获取方法上边的注解 替代path variable 为 *
Anonymous
method
=
AnnotationUtils
.
findAnnotation
(
handlerMethod
.
getMethod
(),
Anonymous
.
class
);
Anonymous
method
=
AnnotationUtils
.
findAnnotation
(
handlerMethod
.
getMethod
(),
Anonymous
.
class
);
Optional
.
ofNullable
(
method
).
ifPresent
(
anonymous
->
info
.
getPatternsCondition
().
getPatterns
()
Optional
.
ofNullable
(
method
).
ifPresent
(
anonymous
->
Objects
.
requireNonNull
(
info
.
getPatternsCondition
().
getPatterns
()
)
.
forEach
(
url
->
urls
.
add
(
RegExUtils
.
replaceAll
(
url
,
PATTERN
,
ASTERISK
))));
.
forEach
(
url
->
urls
.
add
(
RegExUtils
.
replaceAll
(
url
,
PATTERN
,
ASTERISK
))));
// 获取类上边的注解, 替代path variable 为 *
// 获取类上边的注解, 替代path variable 为 *
Anonymous
controller
=
AnnotationUtils
.
findAnnotation
(
handlerMethod
.
getBeanType
(),
Anonymous
.
class
);
Anonymous
controller
=
AnnotationUtils
.
findAnnotation
(
handlerMethod
.
getBeanType
(),
Anonymous
.
class
);
Optional
.
ofNullable
(
controller
).
ifPresent
(
anonymous
->
info
.
getPatternsCondition
().
getPatterns
()
Optional
.
ofNullable
(
controller
).
ifPresent
(
anonymous
->
Objects
.
requireNonNull
(
info
.
getPatternsCondition
().
getPatterns
()
)
.
forEach
(
url
->
urls
.
add
(
RegExUtils
.
replaceAll
(
url
,
PATTERN
,
ASTERISK
))));
.
forEach
(
url
->
urls
.
add
(
RegExUtils
.
replaceAll
(
url
,
PATTERN
,
ASTERISK
))));
});
});
}
}
...
...
Write
Preview
Supports
Markdown
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