pedrosans commented on code in PR #1369:
URL: https://github.com/apache/wicket/pull/1369#discussion_r2813478246


##########
wicket-cdi/src/main/java/org/apache/wicket/cdi/CdiConfiguration.java:
##########
@@ -110,6 +77,13 @@ public CdiConfiguration setFallbackBeanManager(BeanManager 
fallbackBeanManager)
         */
        public void configure(Application application)
        {
+               if(beanManager == null)
+                       beanManager = BeanManagerLookup.lookup();
+
+               if (beanManager == null)
+                       throw new IllegalStateException(
+                               "No BeanManager was set or found via the CDI 
provider. Check your CDI setup or specify a BeanManager in the 
CdiConfiguration.");

Review Comment:
   > > Another benefit of this change is the reduced number of times the new 
code will make expensive (time consuming) JNDI lookups.
   
   > Is it really ?
   > Before there was a BeanManagerLookup#lastSuccessful cache. Now it is gone 
and every BeanManagerLookup#lookup() always makes two JNDI lookups.
   
   There are no code inside the module calling BeanManagerLookup lookup more 
than once (CdiConfiguration#configure is meant to be called once), contrary to 
the previous implementation. NonContextual called BeanManagerLookup during the 
request response, so the number of JNDI lookups was tied to the number of 
requests.



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