Skip to content

io microsphere spring context event EventPublishingBeanInitializer

github-actions[bot] edited this page Jul 5, 2026 · 28 revisions

EventPublishingBeanInitializer

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/EventPublishingBeanInitializer.java

Overview

An ApplicationContextInitializer that registers processors to publish Spring bean lifecycle events during context initialization.

This initializer executes with the highest priority to guarantee that bean event publishing capabilities are established before other components are processed. It automatically registers an EventPublishingBeanBeforeProcessor as a org.springframework.beans.factory.config.BeanFactoryPostProcessor.

Configuration Properties

- `microsphere.spring.event-publishing-bean.enabled` -
    Whether to enable the EventPublishingBean* (default: `false`).

Example Usage

1. Configuration

** application.properties (Spring Boot):**

microsphere.spring.event-publishing-bean.enabled=true

** spring.factories (Spring Boot):**

`org.springframework.context.ApplicationContextInitializer=\
io.microsphere.spring.context.event.EventPublishingBeanInitializer
`

2. Programmatic

`new SpringApplicationBuilder(MyApplication.class)
 .initializers(new EventPublishingBeanInitializer())
 .properties("microsphere.spring.event-publishing-bean.enabled=true")
 .run(args);
`

Declaration

public class EventPublishingBeanInitializer extends ConfigurableApplicationContextInitializer implements PriorityOrdered

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.2.34-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

Example 1

org.springframework.context.ApplicationContextInitializer=\
io.microsphere.spring.context.event.EventPublishingBeanInitializer

Example 2

new SpringApplicationBuilder(MyApplication.class)
 .initializers(new EventPublishingBeanInitializer())
 .properties("microsphere.spring.event-publishing-bean.enabled=true")
 .run(args);

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.EventPublishingBeanInitializer;

API Reference

Public Methods

Method Description
getOrder
getEnabledPropertyName
getDefaultEnabled

See Also

  • EventPublishingBeanBeforeProcessor
  • EventPublishingBeanAfterProcessor
  • BeanListeners
  • BeanListener
  • BeanListenerAdapter
  • BeanFactoryListeners
  • BeanFactoryListener
  • BeanFactoryListenerAdapter
  • ApplicationContextInitializer
  • PriorityOrdered

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