feat(spring): Boot 4 embedded test database and sampled-only SQL comments#241
Merged
Conversation
…ents Two polish items surfaced by running the example applications on Spring Boot 4. - @DataStormTest provides an embedded test database on Spring Boot 4: a fallback auto-configuration in the slice activates only when Boot's own test-database replacement is absent (relocated to spring-boot-jdbc-test-autoconfigure in Boot 4), an embedded driver is on the test classpath, and spring.test.database.replace is not none. Ordered before the DataSource auto-configuration, whose back-off then applies naturally; inert on Boot 3. Slice tests behave identically on both generations without manual datasource properties. - Trace-context SQL comments gain a sampled-only mode: TraceContextSqlCommenter(tracer, onlySampled) comments only statements of sampled traces, aligning the prepared-statement-caching cost with the correlation benefit when sampling is below 1.0. In the starters, storm.tracing.sql-comments accepts true or sampled, and unknown values fail startup with a descriptive error. The docs also gain a composition warning: integration beans in user configurations must be unconditional, because @ConditionalOnBean in a plain @configuration evaluates before auto-configurations contribute their beans and fails silently. Fixes #238 Fixes #239
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.
Two polish items surfaced by running the example applications on Spring Boot 4.
Fixes #238
Fixes #239
@DataStormTest: embedded test database on Spring Boot 4 (#238)
Spring Boot 3 replaces the application's
DataSourcewith an embedded database through its ownTestDatabaseAutoConfiguration, which the slice imports. Spring Boot 4 relocated that behavior to the separatespring-boot-jdbc-test-autoconfigureartifact, so Boot 4 slice tests needed manual datasource properties.The slice now ships a fallback auto-configuration, triple-gated: it activates only when Boot's own replacement is absent (class condition on both its locations), an embedded driver is on the test classpath, and
spring.test.database.replaceis notnone(the Testcontainers opt-out). Ordered before the DataSource auto-configuration, whose back-off then applies naturally. Inert on Boot 3 by construction.Trace-context SQL comments: sampled-only mode (#239)
With sampling below 1.0, commenting every statement pays the prepared-statement-caching cost on all statements for comments that correlate to an exported trace only in the sampled fraction.
TraceContextSqlCommenter(tracer, onlySampled)comments only statements of sampled traces; in the starters,storm.tracing.sql-commentsacceptssampledalongsidetrue, and unknown values fail startup with a descriptive error.Docs
The Boot 3/4 asymmetry paragraph in the slice docs collapses to one sentence; the sql-comments docs recommend
sampledunder partial sampling; and a new composition warning covers the@ConditionalOnBeantrap: conditions in user@Configurationclasses evaluate before auto-configurations contribute their beans (such as theTracer) and fail silently — integration beans in user configurations should be unconditional.Verification
@DataStormTestclasses (Spring Boot 4.1) pass with their manual datasource properties deleted, running entirely on the new fallback. Boot 3 verified inert through the module's own suite.sampledand fails fast on unknown values.