From 39fba77e11bce1b68a4485cb6cc58d936c253e6f Mon Sep 17 00:00:00 2001 From: Thomas Papke Date: Thu, 31 Aug 2023 11:27:19 +0200 Subject: [PATCH 1/3] #580 Build artifact contain certain unused (but declared) dependencies --- pom.xml | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index 3b38277..00dfdf5 100644 --- a/pom.xml +++ b/pom.xml @@ -42,6 +42,15 @@ + + + + org.glassfish.jaxb + jaxb-runtime + 2.3.8 + + + @@ -62,17 +71,7 @@ com.microsoft.sqlserver mssql-jdbc - - jakarta.xml.bind - jakarta.xml.bind-api - 2.3.3 - - - com.sun.xml.bind - jaxb-ri - 2.3.5 - pom - + org.simplejavamail @@ -212,11 +211,6 @@ - - org.webjars - bootstrap - 5.1.3 - org.webjars Eonasdan-bootstrap-datetimepicker @@ -252,6 +246,12 @@ hapi-fhir-jpaserver-test-utilities ${project.version} test + + + com.sun.xml.bind + jaxb-impl + + org.eclipse.jetty @@ -319,7 +319,7 @@ org.awaitility awaitility - 4.1.0 + 4.2.0 test @@ -339,14 +339,14 @@ io.micrometer micrometer-core - 1.9.4 + 1.11.3 io.micrometer micrometer-registry-prometheus - 1.9.4 + 1.11.3 @@ -402,7 +402,12 @@ org.apache.maven.plugins maven-dependency-plugin - 3.2.0 + 3.6.0 + + + org.apache.maven.plugins + maven-surefire-plugin + 3.1.2 @@ -430,7 +435,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.11.0 11 @@ -581,7 +586,7 @@ --> - + From 63c4825d569b070ae2f47b8fb5cb96a647c2391a Mon Sep 17 00:00:00 2001 From: Husam Nujaim <60360833+HussamNujaim@users.noreply.github.com> Date: Sun, 3 Sep 2023 01:15:10 +0200 Subject: [PATCH 2/3] Fixing some typos in README.md --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index dbb5740..0184cc5 100644 --- a/README.md +++ b/README.md @@ -235,7 +235,7 @@ Server will then be accessible at http://localhost:8080/ and eg. http://localhos ```bash mvn clean package spring-boot:repackage -Pboot && java -jar target/ROOT.war ``` -Server will then be accessible at http://localhost:8080/ and eg. http://localhost:8080/fhir/metadata. Remember to adjust you overlay configuration in the application.yaml to eg. +Server will then be accessible at http://localhost:8080/ and eg. http://localhost:8080/fhir/metadata. Remember to adjust your overlay configuration in the application.yaml to eg. ```yaml tester: @@ -250,7 +250,7 @@ Server will then be accessible at http://localhost:8080/ and eg. http://localhos ```bash mvn clean package com.google.cloud.tools:jib-maven-plugin:dockerBuild -Dimage=distroless-hapi && docker run -p 8080:8080 distroless-hapi ``` -Server will then be accessible at http://localhost:8080/ and eg. http://localhost:8080/fhir/metadata. Remember to adjust you overlay configuration in the application.yaml to eg. +Server will then be accessible at http://localhost:8080/ and eg. http://localhost:8080/fhir/metadata. Remember to adjust your overlay configuration in the application.yaml to eg. ```yaml tester: @@ -266,7 +266,7 @@ Server will then be accessible at http://localhost:8080/ and eg. http://localhos ```bash ./build-docker-image.sh && docker run -p 8080:8080 hapi-fhir/hapi-fhir-jpaserver-starter:latest ``` -Server will then be accessible at http://localhost:8080/ and eg. http://localhost:8080/fhir/metadata. Remember to adjust you overlay configuration in the application.yaml to eg. +Server will then be accessible at http://localhost:8080/ and eg. http://localhost:8080/fhir/metadata. Remember to adjust your overlay configuration in the application.yaml to eg. ```yaml tester: @@ -307,7 +307,7 @@ spring: # Then comment all hibernate.search.backend.* ``` -Because the integration tests within the project rely on the default H2 database configuration, it is important to either explicity skip the integration tests during the build process, i.e., `mvn install -DskipTests`, or delete the tests altogether. Failure to skip or delete the tests once you've configured PostgreSQL for the datasource.driver, datasource.url, and hibernate.dialect as outlined above will result in build errors and compilation failure. +Because the integration tests within the project rely on the default H2 database configuration, it is important to either explicitly skip the integration tests during the build process, i.e., `mvn install -DskipTests`, or delete the tests altogether. Failure to skip or delete the tests once you've configured PostgreSQL for the datasource.driver, datasource.url, and hibernate.dialect as outlined above will result in build errors and compilation failure. ### Microsoft SQL Server configuration @@ -322,14 +322,14 @@ spring: driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver ``` -Also, make sure you are not setting the Hibernate dialect explicitly, in other words remove any lines similar to: +Also, make sure you are not setting the Hibernate dialect explicitly, in other words, remove any lines similar to: ``` hibernate.dialect: {some none Microsoft SQL dialect} ``` -Because the integration tests within the project rely on the default H2 database configuration, it is important to either explicity skip the integration tests during the build process, i.e., `mvn install -DskipTests`, or delete the tests altogether. Failure to skip or delete the tests once you've configured PostgreSQL for the datasource.driver, datasource.url, and hibernate.dialect as outlined above will result in build errors and compilation failure. +Because the integration tests within the project rely on the default H2 database configuration, it is important to either explicitly skip the integration tests during the build process, i.e., `mvn install -DskipTests`, or delete the tests altogether. Failure to skip or delete the tests once you've configured PostgreSQL for the datasource.driver, datasource.url, and hibernate.dialect as outlined above will result in build errors and compilation failure. NOTE: MS SQL Server by default uses a case-insensitive codepage. This will cause errors with some operations - such as when expanding case-sensitive valuesets (UCUM) as there are unique indexes defined on the terminology tables for codes. @@ -373,7 +373,7 @@ Again, browse to the following link to use the server (note that the port 8080 m [http://localhost:8080/](http://localhost:8080/) -You will then be able access the JPA server e.g. using http://localhost:8080/fhir/metadata. +You will then be able to access the JPA server e.g. using http://localhost:8080/fhir/metadata. If you would like it to be hosted at eg. hapi-fhir-jpaserver, eg. http://localhost:8080/hapi-fhir-jpaserver/ or http://localhost:8080/hapi-fhir-jpaserver/fhir/metadata - then rename the WAR file to ```hapi-fhir-jpaserver.war``` and adjust the overlay configuration accordingly e.g. @@ -390,7 +390,7 @@ If you would like it to be hosted at eg. hapi-fhir-jpaserver, eg. http://localho ## Deploy with docker compose -Docker compose is a simple option to build and deploy container. To deploy with docker compose, you should build the project +Docker compose is a simple option to build and deploy containers. To deploy with docker compose, you should build the project with `mvn clean install` and then bring up the containers with `docker-compose up -d --build`. The server can be reached at http://localhost:8080/. From 2307413a45b9a5a18cb445aaec6ce83d598b01bd Mon Sep 17 00:00:00 2001 From: Jens Kristian Villadsen Date: Tue, 10 Oct 2023 23:09:04 +0200 Subject: [PATCH 3/3] Fixing null beans as mentioned on https://github.com/hapifhir/hapi-fhir-jpaserver-starter/issues/591 --- Dockerfile | 6 ++-- .../common/FhirServerConfigCommon.java | 29 ++++++++++--------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8e6c8b0..6f03d4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -FROM docker.io/library/maven:3.9.2-eclipse-temurin-17 AS build-hapi +FROM docker.io/library/maven:3.9.4-eclipse-temurin-17 AS build-hapi WORKDIR /tmp/hapi-fhir-jpaserver-starter -ARG OPENTELEMETRY_JAVA_AGENT_VERSION=1.26.0 +ARG OPENTELEMETRY_JAVA_AGENT_VERSION=1.31.0 RUN curl -LSsO https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${OPENTELEMETRY_JAVA_AGENT_VERSION}/opentelemetry-javaagent.jar COPY pom.xml . @@ -12,7 +12,7 @@ COPY src/ /tmp/hapi-fhir-jpaserver-starter/src/ RUN mvn clean install -DskipTests -Djdk.lang.Process.launchMechanism=vfork FROM build-hapi AS build-distroless -RUN mvn package spring-boot:repackage -Pboot +RUN mvn package -DskipTests spring-boot:repackage -Pboot RUN mkdir /app && cp /tmp/hapi-fhir-jpaserver-starter/target/ROOT.war /app/main.war diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigCommon.java b/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigCommon.java index f040ab7..d01df5b 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigCommon.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigCommon.java @@ -11,7 +11,6 @@ import ca.uhn.fhir.jpa.starter.AppProperties; import ca.uhn.fhir.jpa.starter.util.JpaHibernatePropertiesProvider; import ca.uhn.fhir.jpa.subscription.match.deliver.email.EmailSenderImpl; import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender; -import ca.uhn.fhir.rest.server.mail.IMailSvc; import ca.uhn.fhir.rest.server.mail.MailConfig; import ca.uhn.fhir.rest.server.mail.MailSvc; import com.google.common.base.Strings; @@ -221,21 +220,23 @@ public class FhirServerConfigCommon { @Bean public IEmailSender emailSender(AppProperties appProperties) { if (appProperties.getSubscription() != null && appProperties.getSubscription().getEmail() != null) { - MailConfig mailConfig = new MailConfig(); - AppProperties.Subscription.Email email = appProperties.getSubscription().getEmail(); - mailConfig.setSmtpHostname(email.getHost()); - mailConfig.setSmtpPort(email.getPort()); - mailConfig.setSmtpUsername(email.getUsername()); - mailConfig.setSmtpPassword(email.getPassword()); - mailConfig.setSmtpUseStartTLS(email.getStartTlsEnable()); - - IMailSvc mailSvc = new MailSvc(mailConfig); - IEmailSender emailSender = new EmailSenderImpl(mailSvc); - - return emailSender; + return buildEmailSender(appProperties.getSubscription().getEmail()); } - return null; + // Return a dummy anonymous function instead of null. Spring does not like null beans. + // TODO Get the signature of ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionDeliveryHandlerFactory + // changed so it does not require an instance of an IEmailSender + return theDetails -> {}; } + + private static IEmailSender buildEmailSender(AppProperties.Subscription.Email email) { + + return new EmailSenderImpl(new MailSvc(new MailConfig() + .setSmtpHostname(email.getHost()) + .setSmtpPort(email.getPort()) + .setSmtpUsername(email.getUsername()) + .setSmtpPassword(email.getPassword()) + .setSmtpUseStartTLS(email.getStartTlsEnable()))); + } }