fpapon commented on a change in pull request #240:
URL: https://github.com/apache/shiro/pull/240#discussion_r449244026



##########
File path: 
config/ogdl/src/main/java/org/apache/shiro/config/ogdl/ReflectionBuilder.java
##########
@@ -287,10 +287,15 @@ private String parseBeanId(String lhs) {
             }
 
             processor.execute();
-        }
 
-        //SHIRO-413: init method must be called for constructed objects that 
are Initializable
-        LifecycleUtils.init(objects.values());
+            //SHIRO-778: onInit method on AuthenticatingRealm is called twice
+            objects.keySet().stream()
+                    .filter(key -> !kvPairs.containsKey(key))
+                    .forEach(key -> LifecycleUtils.init(objects.get(key)));
+        } else {
+            //SHIRO-413: init method must be called for constructed objects 
that are Initializable
+            LifecycleUtils.init(objects.values());
+        }

Review comment:
       I'm not sure that users can use the buildObjects, it's not a part of the 
public api so I can't see the case where this method will be call several time 
at startup.
   But if we need to add a control, may be we can add a boolean method in the 
Initializable interface to define if the bean has been initialized.
   @bdemers @bmhm thoughts?




----------------------------------------------------------------
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.

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


Reply via email to