-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #473 from medizininformatik-initiative/472-extract…
…-common-agent-configuration Extract Common Agent Configuration
- Loading branch information
Showing
8 changed files
with
57 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 2 additions & 38 deletions
40
trust-center-agent/src/main/java/care/smith/fts/tca/TrustCenterAgent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,19 @@ | ||
package care.smith.fts.tca; | ||
|
||
import static java.time.Duration.ofSeconds; | ||
|
||
import ca.uhn.fhir.context.FhirContext; | ||
import care.smith.fts.util.CustomErrorHandler; | ||
import care.smith.fts.util.FhirCodecConfiguration; | ||
import care.smith.fts.util.MetricsConfig; | ||
import care.smith.fts.util.WebClientDefaults; | ||
import care.smith.fts.util.WebClientFactory; | ||
import care.smith.fts.util.auth.HttpServerAuthConfig; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; | ||
import java.net.http.HttpClient; | ||
import care.smith.fts.util.AgentConfiguration; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.context.annotation.Primary; | ||
|
||
@Slf4j | ||
@SpringBootApplication | ||
@ConfigurationPropertiesScan | ||
@Import({ | ||
WebClientDefaults.class, | ||
FhirCodecConfiguration.class, | ||
MetricsConfig.class, | ||
HttpServerAuthConfig.class, | ||
CustomErrorHandler.class, | ||
WebClientFactory.class, | ||
}) | ||
@Import(AgentConfiguration.class) | ||
public class TrustCenterAgent { | ||
|
||
public static void main(String... args) { | ||
SpringApplication.run(TrustCenterAgent.class, args); | ||
} | ||
|
||
@Bean | ||
public FhirContext fhirContext() { | ||
return FhirContext.forR4(); | ||
} | ||
|
||
@Bean | ||
public HttpClient httpClient() { | ||
return HttpClient.newBuilder().connectTimeout(ofSeconds(10)).build(); | ||
} | ||
|
||
@Bean | ||
@Primary | ||
public ObjectMapper defaultObjectMapper() { | ||
return new ObjectMapper().registerModule(new JavaTimeModule()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
util/src/main/java/care/smith/fts/util/AgentConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package care.smith.fts.util; | ||
|
||
import static java.time.Duration.ofSeconds; | ||
|
||
import ca.uhn.fhir.context.FhirContext; | ||
import care.smith.fts.util.auth.HttpServerAuthConfig; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; | ||
import java.net.http.HttpClient; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.context.annotation.Primary; | ||
|
||
@Configuration | ||
@Import({ | ||
WebClientDefaults.class, | ||
FhirCodecConfiguration.class, | ||
MetricsConfig.class, | ||
HttpServerAuthConfig.class, | ||
CustomErrorHandler.class, | ||
WebClientFactory.class, | ||
}) | ||
public class AgentConfiguration { | ||
|
||
@Bean | ||
public FhirContext fhirContext() { | ||
return FhirContext.forR4(); | ||
} | ||
|
||
@Bean | ||
public HttpClient httpClient() { | ||
return HttpClient.newBuilder().connectTimeout(ofSeconds(10)).build(); | ||
} | ||
|
||
@Bean | ||
@Primary | ||
public ObjectMapper defaultObjectMapper() { | ||
return new ObjectMapper().registerModule(new JavaTimeModule()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters