I'm trying to access a socket-binding from my server configuration in a @Singleton @Startup bean. From what I've found on this forum, is that you can lookup socket bindings using JMX:
new ObjectName("jboss.as:socket-binding-group=standard-sockets,socket-binding=ldap"), "port");
However, during startup, this attribute is not yet available. ManagementFactory.getPlatformMBeanServer().queryNames(null, null) does list the MBean, but reading the 'port' attribute gives an AttributeNotFoundException and the following log:
Note that the attribute is available directly after startup (after the log message 'WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) started in ...'). This includes adding the deployments after starting the container.
How do I access the socket-binding from within a @Singleton bean at @Startup? If not possible, how do I delay the startup of the bean until the server is fully started?