Skip to content

fix(server): call server.init after setting server options - #4003

Open
arimu1 wants to merge 2 commits into
jooby-project:mainfrom
arimu1:fix/3995-server-init-after-options
Open

arimu1 wants to merge 2 commits into
jooby-project:mainfrom
arimu1:fix/3995-server-init-after-options

Conversation

@arimu1

@arimu1 arimu1 commented Sep 12, 2026 •

Copy link
Copy Markdown

Summary

  • Stop calling server.init from the Jooby constructor during bootstrap (it ran before runApp applied config-derived ServerOptions).
  • Call server.init for each app in runApp after final options are set, and in JoobyExtension before start.
  • Add regression test ensuring registry ServerOptions match the configured instance after init.

Fixes #3995

Test plan

  • mvn -pl jooby -am test -Dtest=Issue3995,JoobyRunnerTest,ServerTest (Java 21, Maven 3.8+)

Call server.init from runApp only after final ServerOptions are applied,
and from JoobyExtension before start, so the service registry does not
retain stale defaults from bootstrap.

Fixes jooby-project#3995
Call server.init after test server options are finalized and before
start for integration tests that no longer rely on Jooby constructor init.
@codecov

codecov Bot commented Sep 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.16%. Comparing base (177fe30) to head (f8c8510).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4003      +/-   ##
============================================
- Coverage     94.18%   94.16%   -0.03%     
+ Complexity     6655     6652       -3     
============================================
  Files           432      432              
  Lines         20893    20896       +3     
  Branches       2096     2096              
============================================
- Hits          19679    19676       -3     
- Misses          759      764       +5     
- Partials        455      456       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

server: call server.init after setting the server options (not before)

1 participant