//also ensure the instantiated bean has access to the event bus or is subscribed to events if necessary:
//Note: because events are being enabled on this bean here (before the instantiated event below is
//triggered), beans can react to their own instantiation events.
enableEventsIfNecessary(instantiated, beanName);
BeanEvent event = new InstantiatedBeanEvent(beanName, instantiated, Collections.unmodifiableMap(objects));
eventBus.publish(event);
return instantiated;
}