Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<micrometer.version>1.16.2</micrometer.version>
<commons.logging.version>1.3.5</commons.logging.version>
<spring_boot_version>3.5.9</spring_boot_version>
<postgresql.version>42.7.9</postgresql.version>
<postgresql.version>42.7.12</postgresql.version>
<logback_version>1.5.25</logback_version>
</properties>

Expand All @@ -35,7 +35,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>8.11.16-SNAPSHOT</version>
<version>8.11.18-SNAPSHOT</version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to update version to 8.12.0?

</parent>

<artifactId>hapi-fhir-jpaserver-starter</artifactId>
Expand Down
27 changes: 24 additions & 3 deletions src/main/java/ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
import ca.uhn.fhir.jpa.api.IDaoRegistry;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.config.ThreadPoolFactoryConfig;
import ca.uhn.fhir.jpa.api.dao.DaoRegistrationService;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.binary.provider.BinaryAccessProvider;
import ca.uhn.fhir.jpa.config.SearchConfig;
import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil;
import ca.uhn.fhir.jpa.config.util.ResourceCountCacheUtil;
import ca.uhn.fhir.jpa.dao.FulltextSearchSvcImpl;
Expand Down Expand Up @@ -110,7 +113,7 @@
@Configuration
// allow users to configure custom packages to scan for additional beans
@ComponentScan(basePackages = {"${hapi.fhir.custom-bean-packages:}"})
@Import(ThreadPoolFactoryConfig.class)
@Import({ThreadPoolFactoryConfig.class, SearchConfig.class})
public class StarterJpaConfig {

private static final Logger ourLog = LoggerFactory.getLogger(StarterJpaConfig.class);
Expand Down Expand Up @@ -167,14 +170,24 @@ public ApplicationRunner restfulClientFactoryConfigurer(FhirContext fhirContext,
};
}

@Bean
public DaoRegistry daoRegistry(FhirContext theFhirContext) {
return new DaoRegistry(theFhirContext);
}

@Bean
public DaoRegistrationService daoRegistrationService(DaoRegistry theDaoRegistry) {
return new DaoRegistrationService(theDaoRegistry);
}

@Bean
public IResourceSupportedSvc resourceSupportedSvc(IDaoRegistry theDaoRegistry) {
return new DaoRegistryResourceSupportedSvc(theDaoRegistry);
}

@Bean(name = "myResourceCountsCache")
public ResourceCountCache resourceCountsCache(IFhirSystemDao<?, ?> theSystemDao) {
return ResourceCountCacheUtil.newResourceCountCache(theSystemDao);
public ResourceCountCache resourceCountsCache(DaoRegistry theDaoRegistry) {
return ResourceCountCacheUtil.newResourceCountCache(theDaoRegistry);
}

@Primary
Expand Down Expand Up @@ -334,6 +347,7 @@ public RestfulServer restfulServer(
IFhirSystemDao<?, ?> fhirSystemDao,
AppProperties appProperties,
DaoRegistry daoRegistry,
List<IFhirResourceDao<?>> resourceDaos,
Optional<MdmProviderLoader> mdmProviderProvider,
IJpaSystemProvider jpaSystemProvider,
ResourceProviderFactory resourceProviderFactory,
Expand Down Expand Up @@ -363,6 +377,13 @@ public RestfulServer restfulServer(
DiffProvider diffProvider) {
RestfulServer fhirServer = new RestfulServer(fhirSystemDao.getContext());

/*
* Resource providers are selected from the DaoRegistry below.
* Force the generated resource DAOs to initialize and self-register
* before the provider suppliers are evaluated.
*/
ourLog.info("Initialized {} JPA resource DAO(s)", resourceDaos.size());

List<String> supportedResourceTypes = appProperties.getSupported_resource_types();

if (!supportedResourceTypes.isEmpty()) {
Expand Down