mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-05-10 15:17:05 +08:00
优化
This commit is contained in:
@@ -43,7 +43,7 @@ public class AopAuthorizingController extends StaticMethodMatcherPointcutAdvisor
|
||||
@Autowired
|
||||
private AopMethodAuthorizeDefinitionParser aopMethodAuthorizeDefinitionParser;
|
||||
|
||||
private DefaultAopMethodAuthorizeDefinitionParser defaultParser = new DefaultAopMethodAuthorizeDefinitionParser();
|
||||
// private DefaultAopMethodAuthorizeDefinitionParser defaultParser = new DefaultAopMethodAuthorizeDefinitionParser();
|
||||
|
||||
private boolean autoParse = false;
|
||||
|
||||
@@ -209,7 +209,7 @@ public class AopAuthorizingController extends StaticMethodMatcherPointcutAdvisor
|
||||
|| AnnotationUtils.findAnnotation(aClass, method, Authorize.class) != null;
|
||||
|
||||
if (support && autoParse) {
|
||||
defaultParser.parse(aClass, method);
|
||||
aopMethodAuthorizeDefinitionParser.parse(aClass, method);
|
||||
}
|
||||
return support;
|
||||
}
|
||||
@@ -217,13 +217,14 @@ public class AopAuthorizingController extends StaticMethodMatcherPointcutAdvisor
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
if (autoParse) {
|
||||
List<AuthorizeDefinition> definitions = defaultParser.getAllParsed()
|
||||
.stream().filter(def -> !def.isEmpty())
|
||||
List<AuthorizeDefinition> definitions = aopMethodAuthorizeDefinitionParser.getAllParsed()
|
||||
.stream()
|
||||
.filter(def -> !def.isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
log.info("publish AuthorizeDefinitionInitializedEvent,definition size:{}", definitions.size());
|
||||
eventPublisher.publishEvent(new AuthorizeDefinitionInitializedEvent(definitions));
|
||||
|
||||
defaultParser.destroy();
|
||||
// defaultParser.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.hswebframework.web.authorization.basic.define;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.*;
|
||||
import org.hswebframework.web.authorization.annotation.*;
|
||||
import org.hswebframework.web.authorization.define.*;
|
||||
@@ -24,8 +25,11 @@ import java.util.stream.Collectors;
|
||||
@ToString
|
||||
public class DefaultBasicAuthorizeDefinition implements AopAuthorizeDefinition {
|
||||
|
||||
@JsonIgnore
|
||||
private Class targetClass;
|
||||
|
||||
|
||||
@JsonIgnore
|
||||
private Method targetMethod;
|
||||
|
||||
private ResourcesDefinition resources = new ResourcesDefinition();
|
||||
|
||||
Reference in New Issue
Block a user