Hi Alexander, We have a property for that: https://github.com/apache/openwebbeans/blob/master/webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java#L85 After you can run at build time a cdi container with ClassLoaderProxyService.Spy on - can use CDI SE API, you iterate over all beans and trigger the proxy generation for all the ones needing ones (decorated, intercepted, ...) - just looking up an instance should be sufficient since instantiation is lazy normally, just ensure it does not trigger postconstruct or so. Once done you lookup in WebBeansContext the Spy instance (needs to be casted) then you have all proxies you can dump calling getProxies(). Finally the runtime just needs to setup ClassLoaderProxyService.LoadFirst and ensure to have the dumped proxies in the classpath.
Just these steps avoid generating the proxies at runtime but load them assuming they exist (if not it will try to generate them). For GraalVM (native mode), you need to ensure the dumped proxies are in the native-image classpath and part of the reflection metadata to ensure it works. Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://rmannibucau.metawerx.net/> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book <https://www.packtpub.com/application-development/java-ee-8-high-performance> Le lun. 3 août 2020 à 15:32, Alexander Fischer <fische...@mailbox.org.invalid> a écrit : > Hey Romain, > > since our last mails I have started to work on the native part of the > story. I roughly got to know proxies, their use cases and bytecode > enhancement with Byte-Buddy (as it also uses ASM, like OWB). > For OWB, the next step towards a build time proxy generation is to apply > static naming for the generated proxies, as we need fixed look-up names > at native-image runtime. > I'm currently looking into how naming is done in OWB and wonder if > static proxy naming should be an option for the proxy generation or if > it should always be static after we tackled this issue. > Any thoughts on that? > > Thanks and best regards, > Alex > >