@ Override protected WeldCreationalContext < T > getCreationalContext ( ManagedObjectInvocationContext < T > invocationContext ) { ManagedObjectContext managedObjectContext = invocationContext . getManagedObjectContext ( ) ; @ SuppressWarnings ( "unchecked" ) WeldCreationalContext < T > creationalContext = managedObjectContext . getContextData ( WeldCreationalContext . class ) ; AroundConstructCallback < T > callback = new EJBInterceptorAroundConstructCallback < T > ( invocationContext ) ; //we don't want weld to invoke any @AroundConstruct interceptors ... we will drive them all via a callback //so register our callback creationalContext . registerAroundConstructCallback ( callback ) ; //and stop weld from invoking them creationalContext . setConstructorInterceptionSuppressed ( true ) ; return creationalContext ; }
Get the CreationalContext from the ManagedObjectInvocationContext Register our AroundConstruct callback and stop Weld from invoking any