spring-projects / spring-projects/spring-modulith

EnablePersistentDomainEvents annotation can't be used

Open
#374 5 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Jan 16, 2024.

meta: waiting for feedback
Dominant language
Java
Stars
1.2k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

Looks like EnablePersistentDomainEvents will select EventPublicationConfiguration for import and at the same time EventPublicationAutoConfiguration extends EventPublicationConfiguration so if you add EnablePersistentDomainEvents annotation then the application fails to start

***************************
APPLICATION FAILED TO START
***************************

Description:

The bean 'eventPublicationRegistry', defined in class path resource [org/springframework/modulith/events/config/EventPublicationAutoConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/modulith/events/config/EventPublicationConfiguration.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

Workaround for now seems to be to either enable overriding or just not using the annotation and manually importing your EventPublicationConfigurationExtension and EventSerializationConfigurationExtension implementations.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.