Skip to content

io microsphere spring context event LoggingBeanFactoryListener

github-actions[bot] edited this page Jul 11, 2026 · 25 revisions

LoggingBeanFactoryListener

Type: Class | Module: microsphere-spring-context | Package: io.microsphere.spring.context.event | Since: 1.0.0

Source: microsphere-spring-context/src/main/java/io/microsphere/spring/context/event/LoggingBeanFactoryListener.java

Overview

A BeanFactoryListener implementation that provides logging capabilities for Spring BeanFactory events.

This class logs the key lifecycle events of a Spring BeanFactory, such as when a BeanDefinitionRegistry is ready, when a ConfigurableListableBeanFactory is initialized, and when the BeanFactory configuration is frozen. The logging is done using the Logger interface provided by the MicroSphere logging framework.

Example Usage

`// Register the LoggingBeanFactoryListener with the Spring context
context.addBeanFactoryListener(new LoggingBeanFactoryListener());
`

When the BeanFactory events are triggered, log messages will be generated similar to the following:

INFO  onBeanDefinitionRegistryReady - BeanDefinitionRegistry : org.springframework.beans.factory.support.DefaultListableBeanFactory@1f9e655
INFO  onBeanFactoryReady - BeanFactory : org.springframework.beans.factory.support.DefaultListableBeanFactory@1f9e655
INFO  onBeanFactoryConfigurationFrozen - BeanFactory : org.springframework.beans.factory.support.DefaultListableBeanFactory@1f9e655

These logs provide visibility into the internal state of the Spring container during startup and can be useful for debugging and monitoring purposes.

Declaration

public class LoggingBeanFactoryListener implements BeanFactoryListener

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.2.36-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

// Register the LoggingBeanFactoryListener with the Spring context
context.addBeanFactoryListener(new LoggingBeanFactoryListener());

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-spring-context</artifactId>
    <version>${microsphere-spring.version}</version>
</dependency>

Tip: Use the BOM (microsphere-spring-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.spring.context.event.LoggingBeanFactoryListener;

API Reference

Public Methods

Method Description
onBeanDefinitionRegistryReady
onBeanFactoryReady
onBeanFactoryConfigurationFrozen

See Also

  • EventPublishingBeanInitializer
  • EventPublishingBeanBeforeProcessor
  • EventPublishingBeanAfterProcessor
  • BeanFactoryListeners
  • BeanFactoryListener
  • BeanFactoryListenerAdapter
  • ConfigurableListableBeanFactory
  • DefaultListableBeanFactory

This documentation was auto-generated from the source code of microsphere-spring.

Home

spring-context

spring-guice

spring-jdbc

spring-test

spring-web

spring-webflux

spring-webmvc

Clone this wiki locally