GH-1763 - Register JDBC event publication auto-configuration for JDBC slice tests. - #1863
Open
dlwhdgus0810 wants to merge 1 commit into
Open
Conversation
dlwhdgus0810
marked this pull request as ready for review
September 9, 2026 19:22
…ration for JDBC slice tests. @jdbcTest and @DataJdbcTest slices did not include JdbcEventPublicationAutoConfiguration, so no EventPublicationRepository was available in those tests. We now list it in an AutoConfigureJdbc.imports file, which @DataJdbcTest picks up through @AutoConfigureJdbc as well. The Jackson-based EventSerializer configurations are listed as optional entries, as the repository cannot be created without a serializer and Boot's JSON auto-configuration is not part of the JDBC slices. Signed-off-by: Hyun Lee <dlwhdugs4147@gmail.com>
dlwhdgus0810
force-pushed
the
gh-1763-public-jdbc-autoconfiguration
branch
from
September 11, 2026 00:30
cd60799 to
7ff8dfb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1763.
Reworked following the suggestion in #1763: instead of making
JdbcEventPublicationAutoConfigurationpublic, the JDBC-specific auto-configuration is now included in the corresponding slice tests out of the box, along the lines of GH-1706. The earlier visibility change is dropped.META-INF/spring/org.springframework.boot.jdbc.test.autoconfigure.AutoConfigureJdbc.importstospring-modulith-events-jdbc.@AutoConfigureDataJdbcis meta-annotated with@AutoConfigureJdbc, so the single file covers both@JdbcTestand@DataJdbcTest.EventSerializerconfigurations asoptional:entries in the same file. The repository cannot be created without a serializer and the JSON auto-configuration is not part of the JDBC slices, so registering the JDBC configuration alone would make@JdbcTestfail to start for anyone withspring-modulith-events-jdbcon the classpath and no serializer in the slice. Both serializer configurations are@ConditionalOnMissingBean(EventSerializer.class), so a serializer declared or mocked in a test still takes precedence. If you would rather have that registration live inspring-modulith-events-jackson, I'm happy to move it.JdbcEventPublicationSliceAutoConfigurationIntegrationTestsbootstraps@JdbcTestand@DataJdbcTestconfigurations through anApplicationContextRunner, as the Application-module-aware Flyway migrations not activated when Boot's slice test annotations are used #1706 test does, and expects a singleEventPublicationRepositoryandEventSerializer. Both cases fail without the imports file, and fail withNo qualifying bean of type 'EventSerializer'without the Jackson entries. The@DataJdbcTestfixture carries@AutoConfigurationPackage, as Spring Data JDBC's repository scanning needs a base package when no@SpringBootApplicationis present.spring-boot-data-jdbc-testandspring-modulith-events-jacksonas test dependencies of the JDBC module.