Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnablePersistentDomainEvents annotation can't be used #374

Open
v3rm0n opened this issue Nov 16, 2023 · 5 comments · May be fixed by #414
Open

EnablePersistentDomainEvents annotation can't be used #374

v3rm0n opened this issue Nov 16, 2023 · 5 comments · May be fixed by #414
Assignees
Labels
meta: waiting for feedback Waiting for feedback of the original reporter

Comments

@v3rm0n
Copy link

v3rm0n commented Nov 16, 2023

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.

mfedirko pushed a commit to mfedirko/spring-modulith that referenced this issue Dec 13, 2023
…ibility with EventPublicationAutoConfiguration
@odrotbohm
Copy link
Member

Can you elaborate on why you would want to use the annotation explicitly? It's a left-over from the times in which Spring Boot was not a mandatory dependency. There's no real use for that any more, except in our very own integration testing code.

@odrotbohm odrotbohm added the meta: waiting for feedback Waiting for feedback of the original reporter label Jan 16, 2024
@odrotbohm odrotbohm self-assigned this Jan 16, 2024
@v3rm0n
Copy link
Author

v3rm0n commented Jan 17, 2024

Ah ok, I couldn't figure out a better way to use spring-modulith-events without other parts of modulith project.

@odrotbohm
Copy link
Member

Can you elaborate on what you were trying to do? spring-modulith-events is not an actual artifact but solely a parent project for the individual ones. I.e. it doesn't really make sense to want to use that one in particular.

@v3rm0n
Copy link
Author

v3rm0n commented Jan 17, 2024

Actual modules I added were

implementation 'org.springframework.modulith:spring-modulith-events-core'
implementation 'org.springframework.modulith:spring-modulith-events-jackson'
implementation 'org.springframework.modulith:spring-modulith-events-jdbc'

My goal is to use the persistent events logic in our modular monolith project without using full spring modulith

@v3rm0n
Copy link
Author

v3rm0n commented Jan 31, 2024

Just fyi not an issue for me personally anymore, since using full Modulith instead of events only is not an issue actually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta: waiting for feedback Waiting for feedback of the original reporter
Projects
None yet
2 participants