1414import org .hswebframework .web .utils .AnnotationUtils ;
1515import org .reactivestreams .Publisher ;
1616import org .springframework .aop .support .StaticMethodMatcherPointcutAdvisor ;
17+ import org .springframework .beans .factory .SmartInitializingSingleton ;
1718import org .springframework .beans .factory .annotation .Autowired ;
1819import org .springframework .boot .CommandLineRunner ;
1920import org .springframework .context .ApplicationEventPublisher ;
3536 */
3637@ Slf4j
3738@ SuppressWarnings ("all" )
38- public class AopAuthorizingController extends StaticMethodMatcherPointcutAdvisor implements CommandLineRunner , MethodInterceptor , Ordered {
39+ public class AopAuthorizingController extends StaticMethodMatcherPointcutAdvisor
40+ implements CommandLineRunner , MethodInterceptor , Ordered , SmartInitializingSingleton {
3941
4042 private static final long serialVersionUID = 1154190623020670672L ;
4143
@@ -198,6 +200,26 @@ public boolean matches(Method method, Class<?> aClass) {
198200
199201 @ Override
200202 public void run (String ... args ) throws Exception {
203+ // if (autoParse) {
204+ // List<AuthorizeDefinition> definitions = aopMethodAuthorizeDefinitionParser
205+ // .getAllParsed()
206+ // .stream()
207+ // .filter(def -> !def.isEmpty())
208+ // .collect(Collectors.toList());
209+ // log.info("publish AuthorizeDefinitionInitializedEvent,definition size:{}", definitions.size());
210+ // eventPublisher.publishEvent(new AuthorizeDefinitionInitializedEvent(definitions));
211+ //
212+ // // defaultParser.destroy();
213+ // }
214+ }
215+
216+ @ Override
217+ public int getOrder () {
218+ return Ordered .HIGHEST_PRECEDENCE ;
219+ }
220+
221+ @ Override
222+ public void afterSingletonsInstantiated () {
201223 if (autoParse ) {
202224 List <AuthorizeDefinition > definitions = aopMethodAuthorizeDefinitionParser
203225 .getAllParsed ()
@@ -210,9 +232,4 @@ public void run(String... args) throws Exception {
210232 // defaultParser.destroy();
211233 }
212234 }
213-
214- @ Override
215- public int getOrder () {
216- return Ordered .HIGHEST_PRECEDENCE ;
217- }
218235}
0 commit comments