refactor(di): constructor injection across resources, services, config#89
Merged
Conversation
…172s) Merge 13 distinct test profiles into 7 buckets so same-config @QuarkusTest classes share one Dev Services boot instead of one cold boot (+ new Postgres container) per profile. Cuts the full suite from ~240s to ~172s (-28%), 775 tests green, zero production changes. - New shared profiles: CommonFeaturesProfile (signup + grace + verification meta + oidc admin-group), TurnstileProfile, AltchaProfile. - Delete per-test inner profiles + SignupEnabledProfile/Grace120Profile. - Buckets that can't merge stay separate: altcha/turnstile (mutually exclusive captcha.provider values), csrf + oidc (build-time config). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RMMHVVTHSRwgtu5iC9Nkkj
… tests (172s->161s) Move all CAPTCHA config reads (altcha hmac-key/max-number, turnstile secret/verify-url/site-key) out of scattered @ConfigProperty fields in CaptchaVerifier, AltchaResource and PublicResource into accessor methods on CaptchaProviderConfig — one source of truth. Property names and runtime behavior are unchanged. This lets the 5 altcha/turnstile tests run in the shared default Quarkus boot: @InjectSpy the config bean and override provider()/keys per-test instead of a @testprofile restart (which cold-booted a fresh app + Postgres container each). Drops the suite from 7 boots to 5 (~172s -> ~161s), 775 tests green. Removes AltchaProfile/TurnstileProfile. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RMMHVVTHSRwgtu5iC9Nkkj
Convert field @Inject and @ConfigProperty injection to constructor injection project-wide, matching the existing service-layer convention (BookingService, google package): immutable final collaborators, fail-fast wiring, plain-unit-testable without CDI. JAX-RS resources are @singleton and services run under ArC, so no dummy no-arg ctor is needed. - 13 JAX-RS @path resources: field @Inject -> constructor - 15 services/filters/schedulers: field @Inject -> constructor - 16 classes: @ConfigProperty fields -> ctor params (merged into the above ctors, or new ctors on pure config holders) - SmtpHealthCheckTest: no-arg construction + final-field writes -> ctor args Left as-is by design: - Event<>/Instance<> stay @Inject fields (BookingService plumbing convention) - OidcLoginResource @idtoken: quarkus-oidc verified id_token is field-only - EncryptedStringConverter: JPA AttributeConverter, reflective-instantiation risk 775 tests pass; spotless-formatted. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RMMHVVTHSRwgtu5iC9Nkkj
SonarCloud S1192: the Panache query "ownerId = ?1 and status = ?2 order by startUtc" appeared 3x in AdminResource. Extract to PENDING_BY_OWNER_QUERY constant. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RMMHVVTHSRwgtu5iC9Nkkj
|
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.



Stacks on the test-reboot consolidation already on this branch. Three commits into
main:@TestProfileclasses — cut Quarkus reboots (240s→172s)CaptchaProviderConfig— spy in tests (172s→161s)DI refactor
Convert field
@Injectand@ConfigPropertyinjection to constructor injection project-wide, matching the existing service-layer convention (BookingService, google package): immutablefinalcollaborators, fail-fast wiring, plain-unit-testable without CDI. Resources are@Singletonand services run under ArC, so no dummy no-arg ctor is needed.@Pathresources: field@Inject→ constructor@Inject→ constructor@ConfigPropertyfields → ctor params (merged into the above ctors, or new ctors on pure config holders)SmtpHealthCheckTest: no-arg construction + final-field writes → ctor argsLeft as-is by design
Event<>/Instance<>stay@Injectfields (BookingService plumbing convention)OidcLoginResource@IdToken: quarkus-oidc verified id_token is field-onlyEncryptedStringConverter: JPAAttributeConverter, reflective-instantiation riskFollow-up (not in this PR)
CaptchaProviderConfig(7-arg ctor) andSiteInfo(4-arg) are pure config holders — better as@ConfigMappinginterfaces than fat constructors.Verification
mvn spotless:applycleanmvn test-compileclean🤖 Generated with Claude Code