if (injectedMBeanServer.getValue() != null) {
final ManagedEndpointRegistry managedEndpointRegistry = new ManagedEndpointRegistry();
managedEndpointRegistry.setMbeanServer(injectedMBeanServer.getValue());
registry = managedEndpointRegistry;
} else {
registry = new DefaultEndpointRegistry();
}
}