wzhangNJ commented on code in PR #4161:
URL: https://github.com/apache/shenyu/pull/4161#discussion_r1015091381


##########
shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/client/AbstractContextRefreshedEventListener.java:
##########
@@ -98,14 +98,14 @@ public AbstractContextRefreshedEventListener(final 
PropertiesConfig clientConfig
     
     @Override
     public void onApplicationEvent(@NonNull final ContextRefreshedEvent event) 
{
-        if (!registered.compareAndSet(false, true)) {
-            return;
-        }
         final ApplicationContext context = event.getApplicationContext();
         Map<String, T> beans = getBeans(context);
         if (MapUtils.isEmpty(beans)) {
             return;
         }
+        if (!registered.compareAndSet(false, true)) {

Review Comment:
   Sometimes ,getBeans is empty. 
   ContextRefreshedEvent is Triggered  multiple times. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to