setImportRegistry(ImportRegistry) is public but unreachable from config.yml / the standard entry points

Author: matematicasvedicasCreated Aug 16, 2026Updated Aug 16, 2026

What we ran into

GraphHopper.setImportRegistry(ImportRegistry) (GraphHopper.java, line ~439) is a public method — the clean, intended way to add custom encoded values without forking, per the ImportRegistry/DefaultImportRegistry design that replaced the old two-factory mechanism (#2438).

But none of the standard entry points that ship in graphhopper-web/graphhopper-web-bundle ever call it, and none of them expose a config.yml (or CLI flag) hook to supply a custom ImportRegistry:

So "add a custom encoded value using the officially supported extension point, without a fork" ends up requiring either (a) copying ~300 lines across those four files to reach the one line that actually needs to change, or (b) something fragile like shading a same-named replacement class over GraphHopperManaged on the classpath. Neither feels like what the public setImportRegistry/ImportRegistry API was designed for.

What we ended up doing instead

For anyone hitting this: we found that import and serve don't need to share a process at all. GraphHopper.load() never touches ImportRegistry — it reconstructs the EncodingManager purely via EncodingManager.fromProperties() → EncodedValueSerializer, which is generic Jackson polymorphic deserialization of GraphHopper's own built-in EncodedValue classes (e.g. a custom boolean just becomes a SimpleBooleanEncodedValue with our name, same class GraphHopper already ships). The only load-time consistency check, Profile.getVersion(), hashes name|turn_costs|weighting|hints — it never looks at graph.encoded_values. And GraphHopperConfig is a plain Jackson POJO, loadable without Dropwizard.

So we wrote a small standalone program depending only on graphhopper-core that does new GraphHopper().setImportRegistry(ourRegistry).init(config).importAndClose(), and the unmodified graphhopper-web jar serves the resulting graph with zero changes and zero awareness that our encoded value exists. It works well, but we only found it by reading GraphHopper.java/EncodingManager.java/Profile.java source directly — it's not documented anywhere as the supported path, and a less careful team could easily assume (as we first did) that copying GraphHopperManaged was the "supported-ish" way to do this.

Suggestion

Would a small doc note (or a config.yml/CLI hook to supply an ImportRegistry implementation class by name) be in scope? Either would have saved us a fair amount of source-spelunking. Happy to submit a docs PR describing the decoupled-import approach above if that's useful, even if the extension-point question is a bigger ask.

Version: 11.0. Not a bug exactly — more likely an oversight where the public API and the shipped entry points drifted apart after the ImportRegistry unification.