fix(spring-config): init postgres or mysql datastore conditionally - #94
Conversation
Fail fast when both are on the class path.
There was a problem hiding this comment.
🟡 Not ready to approve
The updated tests/docs have a couple of concrete issues (including an incomplete “DB untouched” assertion and remaining inconsistent documentation elsewhere) that should be corrected before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR addresses issue #90 by removing the non-deterministic “winner” behavior when both okapi-postgres and okapi-mysql are on the classpath, and instead making startup fail fast unless the user explicitly provides an @Bean OutboxStore.
Changes:
- Update
OutboxAutoConfigurationto conditionally activate Postgres/MySQL store configs only when the other store module is absent, and add an explicit “ambiguous classpath” configuration that fails startup. - Update the dual-module tests to assert the new fail-fast behavior and verify the explicit
@Bean OutboxStoreescape hatch. - Adjust the real-DB E2E test scenario to reflect the new startup-failure invariant when both modules are present.
File summaries
| File | Description |
|---|---|
| okapi-spring-boot/src/main/kotlin/com/softwaremill/okapi/springboot/OutboxAutoConfiguration.kt | Add conditional exclusion between Postgres/MySQL store configs and introduce fail-fast AmbiguousStoreConfiguration. |
| okapi-spring-boot/src/test/kotlin/com/softwaremill/okapi/springboot/LiquibaseE2ETest.kt | Update E2E test to expect startup failure in dual-module classpath and assert DB remains untouched. |
| okapi-spring-boot/src/test/kotlin/com/softwaremill/okapi/springboot/LiquibaseAutoConfigurationTest.kt | Replace “exactly one wins” dual-module assertion with fail-fast expectation; add escape-hatch test for explicit OutboxStore. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Low
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
There was a problem hiding this comment.
🟡 Not ready to approve
The PR description says the app should “fail fast when both are on the classpath,” but the implementation instead enforces “Postgres wins,” so the intended contract needs to be clarified and aligned.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
Comments suppressed due to low confidence (1)
okapi-spring-boot/src/main/kotlin/com/softwaremill/okapi/springboot/OutboxAutoConfiguration.kt:58
- PR metadata/description says "Fail fast when both are on the class path", but this implementation instead makes Postgres deterministically win when both okapi-postgres and okapi-mysql are present. That’s a materially different contract (and still allows a silent misconfiguration for MySQL-backed apps that accidentally have both modules). Please clarify the intended behavior and align either the code (add a fail-fast guard when both modules are present and no explicit OutboxStore is provided) or the PR description/documentation accordingly.
* - [OutboxStore] — auto-configured to [PostgresOutboxStore] or [MysqlOutboxStore]
* depending on which module (`okapi-postgres` / `okapi-mysql`) is on the classpath. If *both*
* are present, Postgres takes priority — enforced deterministically via `@Order` on
* [PostgresStoreConfiguration] / [MysqlStoreConfiguration] (issue #90: this was previously only
* documented, not enforced, and MySQL could silently win instead depending on undocumented
* nested-`@Configuration` processing order). Override by defining your own `@Bean OutboxStore`.
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
- Review effort level: Low
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
#90
Postgres wins when both are on the classpath.