I am trying to write a CDI extension which can customise WebServer object to programmatically generate KeyConfig. But the extension is not getting executed in the order I expect.
I wrote a extension class like below
public final class CustomWebServerExtension implements Extension {
public CustomWebServerExtension() {}
private void onStartup(@Observes @Priority(11) @Initialized(ApplicationScoped.class) Object event,
BeanManager beanManager) {
ServerCdiExtension server = beanManager.getExtension(ServerCdiExtension.class);
server.serverBuilder().port(9000).build();
}
}
I am referring to https://github.com/helidon-io/helidon/issues/3727#issuecomment-993535342 to write this bean class.
When I try to run my server, I see that server.serverBuilder() is null. It seems ServerCdiExtension.startServer is getting executed before code is executed. Any pointers how I can fix this?