hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
2k stars 1.31k forks source link

matchResourceUrlService #1278

Open hsolbrig opened 5 years ago

hsolbrig commented 5 years ago

NOTE: Before filing a ticket, please see the following URL: https://github.com/jamesagnew/hapi-fhir/wiki/Getting-Help

Describe the bug hapi-fhir-cli has unsatisfied dependency

To Reproduce Steps to reproduce the behavior:

  1. Download and unzip the hapi-fhir-3.7.0-cli.zip
  2. run ./hapi-fhir-cli run-server -v r4
  3. See error

Expected behavior Server starts

Screenshots

Failed startup of context o.e.j.w.WebAppContext@1d57deae{/,file:///private/var/folders/9r/b4ptppwd2g12t45151svr49w0000gn/T/jetty-0.0.0.0-8091-hapi-fhir2088037074280620245.war-_-any-146202217281835779.dir/webapp/,UNAVAILABLE}{/var/folders/9r/b4ptppwd2g12t45151svr49w0000gn/T/hapi-fhir2088037074280620245.war}
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'matchResourceUrlService': Unsatisfied dependency expressed through field 'myMatchUrlService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'matchUrlService': Unsatisfied dependency expressed through field 'mySearchParamRegistry'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'searchParamRegistry': Unsatisfied dependency expressed through field 'myModelConfig'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'ca.uhn.fhir.jpa.model.entity.ModelConfig' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

Environment (please complete the following information): Java 1.8.0_66 (but appears to fail on same error on 10.0.2) Mac osx Mojave 10.14.4

hsolbrig commented 5 years ago

The following at least partially fixes it:

--- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfigR4.java
+++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfigR4.java
@@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.demo;

 import ca.uhn.fhir.jpa.config.BaseJavaConfigR4;
 import ca.uhn.fhir.jpa.dao.DaoConfig;
+import ca.uhn.fhir.jpa.model.entity.ModelConfig;
 import ca.uhn.fhir.jpa.util.SubscriptionsRequireManualActivationInterceptorR4;
 import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
 import ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor;
@@ -52,6 +53,12 @@ public class FhirServerConfigR4 extends BaseJavaConfigR4 {
                return retVal;
        }

+
+       @Bean
+       public ModelConfig modelConfig() {
+               return daoConfig().getModelConfig();
+       }
+
        @Override
        @Bean
        public LocalContainerEntityManagerFactoryBean entityManagerFactory() {