class BatchObservabilityBeanPostProcessor implements BeanFactoryPostProcessor, BeanPostProcessor {

	private static final Log LOGGER = LogFactory.getLog(BatchObservabilityBeanPostProcessor.class);

	private ConfigurableListableBeanFactory beanFactory;

	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		this.beanFactory = beanFactory;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {<FILL_FUNCTION_BODY>}

}

		try {
			if (bean instanceof AbstractJob || bean instanceof AbstractStep) {
				ObservationRegistry observationRegistry = this.beanFactory.getBean(ObservationRegistry.class);
				if (bean instanceof AbstractJob) {
					((AbstractJob) bean).setObservationRegistry(observationRegistry);
				}
				if (bean instanceof AbstractStep) {
					((AbstractStep) bean).setObservationRegistry(observationRegistry);
				}
			}
		}
		catch (NoSuchBeanDefinitionException e) {
			LOGGER.info("No Micrometer observation registry found, defaulting to ObservationRegistry.NOOP");
		}
		return bean;
	
<no_super_class>