Skip to content

fix: WebFlux base-path support, precompute fullPath, consistent @RequestMapping#3

Merged
JohnPitter merged 2 commits into
mainfrom
fix/context-path-webflux-and-tests
Apr 17, 2026
Merged

fix: WebFlux base-path support, precompute fullPath, consistent @RequestMapping#3
JohnPitter merged 2 commits into
mainfrom
fix/context-path-webflux-and-tests

Conversation

@JohnPitter
Copy link
Copy Markdown
Owner

Summary

Follow-up to #2. Three small fixes surfaced during code review, plus test coverage for the new context-path logic.

  • WebFlux support: TemplateService now falls back to spring.webflux.base-path when server.servlet.context-path is absent. WebFlux apps were silently broken by Refactor: respect server.servlet.context-path for all UI URLs #2.
  • Precompute fullPath: contextPath and properties.getPath() are immutable post-boot, so compute once in the constructor rather than on every request.
  • Consistent @RequestMapping: AlertController and SqlAnalyzerController were the only UI controllers putting the full path on @GetMapping instead of at class level. Aligned with the rest.
  • Tests: 8 JUnit tests covering servlet context-path, WebFlux base-path, trailing-slash normalization, and empty context-path scenarios.

Test plan

  • mvn -pl j-obs-spring-boot-starter test -Dtest=TemplateServiceTest — 8/8 passing
  • mvn -pl j-obs-spring-boot-starter compile — no regressions across the ~20 call sites touched by Refactor: respect server.servlet.context-path for all UI URLs #2
  • Manual smoke test under a Spring Boot app with server.servlet.context-path=/my-app (reviewer)
  • Manual smoke test under a WebFlux app with spring.webflux.base-path=/api (reviewer)

🤖 Generated with Claude Code

JohnPitter and others added 2 commits April 17, 2026 13:43
…estMapping

- TemplateService now falls back to spring.webflux.base-path when
  server.servlet.context-path is absent, fixing WebFlux apps under a
  context path.
- Precompute fullPath in constructor since contextPath and the configured
  j-obs path are immutable post-boot.
- Align AlertController and SqlAnalyzerController with the class-level
  @RequestMapping convention used by the other UI controllers.
- Add TemplateServiceTest covering servlet/WebFlux context-path,
  trailing-slash normalization, and empty context-path scenarios.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
JObsLogAutoConfigurationTest was loading only JObsLogAutoConfiguration,
but LogController now depends on TemplateService, whose @bean lives in
JObsAutoConfiguration (moved there in #2). Add JObsAutoConfiguration to
the test's AutoConfigurations set.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@JohnPitter JohnPitter merged commit 7c570ec into main Apr 17, 2026
11 checks passed
@JohnPitter JohnPitter deleted the fix/context-path-webflux-and-tests branch April 17, 2026 17:02
JohnPitter added a commit that referenced this pull request Apr 17, 2026
- Bump all module versions from 1.1.0 to 1.2.0
- Update README install snippets to 1.2.0
- Document context-path changes (PRs #2 and #3) in CHANGELOG

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@JohnPitter JohnPitter mentioned this pull request Apr 17, 2026
2 tasks
JohnPitter added a commit that referenced this pull request Apr 17, 2026
- Bump all module versions from 1.1.0 to 1.2.0
- Update README install snippets to 1.2.0
- Document context-path changes (PRs #2 and #3) in CHANGELOG

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant