Skip to content

Modernize auto-configuration registration in the moments, events, and observability modules #1774

Description

@ch200203

A few modules still register their auto-configurations the pre-Boot-3 way.

Since Spring Boot 3.X the EnableAutoConfiguration key in META-INF/spring.factories is no longer read (Boot 4.1, which the project now targets, ignores it), and auto-configurations are declared in META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports and annotated @AutoConfiguration. Most of the code base already does this; the changes below bring the remaining stragglers in line and are a no-op at runtime.

This is a follow-up to the cleanup started in #60: dead spring.factories entries in moments and events-jpa, plus a few annotation normalizations across moments, events-jdbc, and observability-core.

1. Remove dead EnableAutoConfiguration entries from spring.factories

  • spring-modulith-moments — the spring.factories only holds EnableAutoConfiguration=…MomentsAutoConfiguration, which is already registered via AutoConfiguration.imports. The whole file can be deleted.
  • spring-modulith-events-jpa — its spring.factories mixes a still-needed EventPublicationConfigurationExtension entry with a dead EnableAutoConfiguration block. JpaEventPublicationAutoConfiguration is already in AutoConfiguration.imports, and JpaEventPublicationConfiguration remains wired through the EventPublicationConfigurationExtension SPI, so only the EnableAutoConfiguration block is removed; the extension entry stays.

2. Use @AutoConfiguration for classes registered via .imports

These are listed in an AutoConfiguration.imports file but still annotated @Configuration(proxyBeanMethods = false). As @AutoConfiguration is meta-annotated with exactly that, switching over is a consistency fix with no behavior change:

  • MomentsAutoConfiguration
  • ModuleObservabilityAutoConfiguration
  • SpringDataRestModuleObservabilityAutoConfiguration
  • JdbcEventPublicationAutoConfiguration — its standalone @AutoConfigureBefore(EventPublicationAutoConfiguration.class) would be folded into @AutoConfiguration(before = EventPublicationAutoConfiguration.class).

No test depends on the removed entries.

I'd be happy to provide a PR 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions