hapi-fhir icon indicating copy to clipboard operation
hapi-fhir copied to clipboard

Break Circular Bean Dependency on MatchUrlService

Open Thopap opened this issue 2 years ago • 0 comments

HAPI JPA server (6.0) currently requires to run with "allow-circular-references" as enabled here: https://github.com/hapifhir/hapi-fhir-jpaserver-starter/commit/3fd880399c81c27094617877483ea6a6b9e09c0b

Without this spring feature, the server run into the following circular dependency: hapiServletRegistration defined in ca.uhn.fhir.jpa.starter.Application ↓ jpaRestfulServer (field ca.uhn.fhir.rest.server.util.ISearchParamRegistry ca.uhn.fhir.jpa.starter.BaseJpaRestfulServer.searchParamRegistry) ┌─────┐ | searchParamRegistry (field private ca.uhn.fhir.jpa.cache.IResourceChangeListenerRegistry ca.uhn.fhir.jpa.searchparam.registry.SearchParamRegistryImpl.myResourceChangeListenerRegistry) ↑ ↓ | resourceChangeListenerRegistry defined in class path resource [ca/uhn/fhir/jpa/searchparam/config/SearchParamConfig.class] ↑ ↓ | inMemoryResourceMatcher (field private ca.uhn.fhir.jpa.searchparam.MatchUrlService ca.uhn.fhir.jpa.searchparam.matcher.InMemoryResourceMatcher.myMatchUrlService) ↑ ↓ | matchUrlService (field private ca.uhn.fhir.rest.server.util.ISearchParamRegistry ca.uhn.fhir.jpa.searchparam.MatchUrlService.mySearchParamRegistry) └─────┘

Requested improvement / change We should break this circular dependency to allow running also without the spring flag.

Thopap avatar Aug 02 '22 06:08 Thopap