diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3804-app-start-fails-because-of-duplicated-bean-definition.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3804-app-start-fails-because-of-duplicated-bean-definition.yaml new file mode 100644 index 00000000000..da2e4946318 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_1_0/3804-app-start-fails-because-of-duplicated-bean-definition.yaml @@ -0,0 +1,5 @@ +--- +type: fix +issue: 3804 +title: "When starting hapi-fhir from starter application, BeanDefinitionOverrideException was thrown with message: Invalid bean + definition with name loadIdsStep. This issue is now fixed." diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/config/SharedCtx.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/config/SharedCtx.java new file mode 100644 index 00000000000..48f01e823a7 --- /dev/null +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/config/SharedCtx.java @@ -0,0 +1,15 @@ +package ca.uhn.fhir.batch2.jobs.config; + +import ca.uhn.fhir.batch2.jobs.step.LoadIdsStep; +import ca.uhn.fhir.jpa.api.svc.IBatch2DaoSvc; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class SharedCtx { + + @Bean + public LoadIdsStep loadIdsStep(IBatch2DaoSvc theBatch2DaoSvc) { + return new LoadIdsStep(theBatch2DaoSvc); + } +} diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/expunge/DeleteExpungeAppCtx.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/expunge/DeleteExpungeAppCtx.java index cf7377e7aa3..7158147674c 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/expunge/DeleteExpungeAppCtx.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/expunge/DeleteExpungeAppCtx.java @@ -22,9 +22,9 @@ package ca.uhn.fhir.batch2.jobs.expunge; import ca.uhn.fhir.batch2.jobs.chunk.PartitionedUrlChunkRangeJson; import ca.uhn.fhir.batch2.jobs.chunk.ResourceIdListWorkChunkJson; +import ca.uhn.fhir.batch2.jobs.config.SharedCtx; import ca.uhn.fhir.batch2.jobs.parameters.UrlListValidator; import ca.uhn.fhir.batch2.jobs.step.GenerateRangeChunksStep; -import ca.uhn.fhir.batch2.jobs.step.LoadIdsStep; import ca.uhn.fhir.batch2.model.JobDefinition; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.api.svc.IBatch2DaoSvc; @@ -36,7 +36,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration -public class DeleteExpungeAppCtx { +public class DeleteExpungeAppCtx extends SharedCtx { public static final String JOB_DELETE_EXPUNGE = "DELETE_EXPUNGE"; @@ -87,11 +87,6 @@ public class DeleteExpungeAppCtx { return new GenerateRangeChunksStep(); } - @Bean - public LoadIdsStep loadIdsStep(IBatch2DaoSvc theBatch2DaoSvc) { - return new LoadIdsStep(theBatch2DaoSvc); - } - @Bean public DeleteExpungeProvider deleteExpungeProvider(FhirContext theFhirContext, IDeleteExpungeJobSubmitter theDeleteExpungeJobSubmitter) { return new DeleteExpungeProvider(theFhirContext, theDeleteExpungeJobSubmitter); diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexAppCtx.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexAppCtx.java index 715902e9002..ce5da7e2b8b 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexAppCtx.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexAppCtx.java @@ -23,10 +23,10 @@ package ca.uhn.fhir.batch2.jobs.reindex; import ca.uhn.fhir.batch2.api.IJobCoordinator; import ca.uhn.fhir.batch2.jobs.chunk.PartitionedUrlChunkRangeJson; import ca.uhn.fhir.batch2.jobs.chunk.ResourceIdListWorkChunkJson; +import ca.uhn.fhir.batch2.jobs.config.SharedCtx; import ca.uhn.fhir.batch2.jobs.parameters.UrlListValidator; import ca.uhn.fhir.batch2.jobs.parameters.UrlPartitioner; import ca.uhn.fhir.batch2.jobs.step.GenerateRangeChunksStep; -import ca.uhn.fhir.batch2.jobs.step.LoadIdsStep; import ca.uhn.fhir.batch2.model.JobDefinition; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.api.svc.IBatch2DaoSvc; @@ -36,7 +36,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration -public class ReindexAppCtx { +public class ReindexAppCtx extends SharedCtx { public static final String JOB_REINDEX = "REINDEX"; @@ -67,6 +67,11 @@ public class ReindexAppCtx { .build(); } + @Bean + public GenerateRangeChunksStep reindexGenerateRangeChunksStep() { + return new GenerateRangeChunksStep(); + } + @Bean public ReindexJobParametersValidator reindexJobParametersValidator(IBatch2DaoSvc theBatch2DaoSvc) { return new ReindexJobParametersValidator(new UrlListValidator(ProviderConstants.OPERATION_REINDEX, theBatch2DaoSvc)); @@ -77,15 +82,7 @@ public class ReindexAppCtx { return new ReindexStep(); } - @Bean - public GenerateRangeChunksStep reindexGenerateRangeChunksStep() { - return new GenerateRangeChunksStep(); - } - @Bean - public LoadIdsStep loadIdsStep(IBatch2DaoSvc theBatch2DaoSvc) { - return new LoadIdsStep(theBatch2DaoSvc); - } @Bean public ReindexProvider reindexProvider(FhirContext theFhirContext, IJobCoordinator theJobCoordinator, IRequestPartitionHelperSvc theRequestPartitionHelperSvc, UrlPartitioner theUrlPartitioner) {