Re: @Produces returning null

2017-11-27 Thread Matthew Broadhead
also i did not realise that @Dependent is a Scope.  so i was declaring @RequestScoped and @Dependent at the same time On 27/11/2017 11:41, Matthew Broadhead wrote: looks like it.  another method was injecting the security context, so i moved it to it own class and now it is working.  changing f

Re: @Produces returning null

2017-11-27 Thread Matthew Broadhead
looks like it.  another method was injecting the security context, so i moved it to it own class and now it is working.  changing from @ApplicationScoped to @RequestScoped must have uncovered the problem.  i set everything to requestscoped now because all only produce on request On 27/11/2017

Re: @Produces returning null

2017-11-27 Thread Romain Manni-Bucau
Loops in you generic usages? Romain Manni-Bucau @rmannibucau | Blog | Old Blog | Github | LinkedIn 2017-11-27 11:29 GMT+01:00 Matthew Broadhead : > starts up ok but then on page load i get > > |java.lang.StackOverflowError at > org.apache.webbeans.util.GenericsUtil.isAssignableFrom(GenericsUtil

Re: @Produces returning null

2017-11-27 Thread Matthew Broadhead
starts up ok but then on page load i get |java.lang.StackOverflowError at org.apache.webbeans.util.GenericsUtil.isAssignableFrom(GenericsUtil.java:172) at org.apache.webbeans.util.GenericsUtil.isAssignableFrom(GenericsUtil.java:146) at org.apache.webbeans.util.GenericsUtil.isAssignableFrom(G

Re: @Produces returning null

2017-11-27 Thread Romain Manni-Bucau
Hi it looks accurate, a normal scoped instance - request scoped - proxies a not null instance so you can't return null. Using a @RequestScoped producer class (the enclosing one) and @Dependent producer can work too if you inject this context in request scoped instances only. Romain Manni-Bucau @r

@Produces returning null

2017-11-27 Thread Matthew Broadhead
if @Produces can produce null e.g. @Produces @Default @RequestScoped public KeycloakSecurityContext keycloakSecurityContext() {     if (httpServletRequest.getUserPrincipal() instanceof KeycloakPrincipal) {         KeycloakPrincipal keycloakPrincipal = (KeycloakPrincipal) httpServletRequest.get