Skip to content

CD and OAS: take configuration from the registered plugin and JsonApi4j instead of servlet-context copies, plus small cleanups #218

Closed

Description

@MoonWorm

The CD filter and the OAS servlet took their configuration from several places at once: servlet-context attributes, a separately built executor, and a raw ObjectMapper lookup. In a plain servlet setup, a plugin's properties existed twice: the instance registered in the PluginRegistry (validated, and shown in the Meta API's config) and a copy the plugin's servlet initializer read from the config file, which the filter or servlet actually used. The two could disagree.

Changes

  • CompoundDocsFilter gets what it needs from JsonApi4j, with one initJsonApi4j call:
    • its properties from jsonApi4j.getPluginRegistry().configOf(CompoundDocsProperties.class) instead of a servlet-context attribute;
    • the root path from jsonApi4j.getProperties();
    • the executor from jsonApi4j.getExecutor();
    • the error handlers from jsonApi4j.getErrorHandlers().
  • OasServlet reads its properties from configOf(OasProperties.class), and gets its ObjectMapper through initObjectMapper. Before, it used a raw attribute lookup with no fallback, so objectMapper could be null.
  • A plugin enabled in config but not registered in the PluginRegistry now logs a warning naming the cause, and its filter or servlet stays inactive. Before, it ran with a separate copy of the configuration.
  • CompoundDocsResolver and CachingCompoundDocsFetcher take an Executor instead of an ExecutorService. They only call supplyAsync, and existing callers still compile.
  • Small fixes: the log typo "initialization failer", and the stale comment on the Quarkus sample's pinned native test port.

Tests

  • INCLUDED_ONLY with an include path that continues through a primary resource: the resource is repeated exactly once, as the fetched copy with the linkage the path needed.
  • Spring wiring: cd.deduplication binds, and the nested mapping entries bind (url, maxBatchSize, propagateCredentials, and a same-app entry with only a batch size).

Verified: the packaged Quarkus app binds nested mapping entries from environment variables set at runtime: JSONAPI4J_CD_MAPPING_DEFAULT_URL, and JSONAPI4J_CD_MAPPING_<TYPE>_URL for a type that appears nowhere in the config. This also holds when the config has no mapping keys at all.

Behaviour change: in a plain servlet setup, CD or OAS enabled in config but not registered in the PluginRegistry is no longer served. Spring and Quarkus always register the plugin.

Activity

  1. added a commit that references this issue on Oct 2, 2026
  2. added a commit that references this issue on Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions