diff --git a/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/Consumers.java b/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/Consumers.java
new file mode 100644
index 00000000000..40cbcebd0e8
--- /dev/null
+++ b/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/Consumers.java
@@ -0,0 +1,30 @@
+package no.nav.registre.orgnrservice.config;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import no.nav.testnav.libs.securitycore.domain.ServerProperties;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+import static lombok.AccessLevel.PACKAGE;
+
+/**
+ * Samler alle placeholders for ulike {@code consumers.*}-konfigurasjon her, dvs. subklasser av {@code ServerProperties}.
+ *
+ * Husk at Spring Boot bruker relaxed binding
+ * mellom configuration properties og field names.
+ *
+ * @see ServerProperties
+ */
+@Configuration
+@ConfigurationProperties(prefix = "consumers")
+@NoArgsConstructor(access = PACKAGE)
+@Getter
+@Setter(PACKAGE)
+public class Consumers {
+
+ private ServerProperties testnavMiljoerService;
+ private ServerProperties testnavOrganisasjonService;
+
+}
diff --git a/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/credentials/MiljoerServiceProperties.java b/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/credentials/MiljoerServiceProperties.java
deleted file mode 100644
index 5b81c6013c4..00000000000
--- a/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/credentials/MiljoerServiceProperties.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package no.nav.registre.orgnrservice.config.credentials;
-
-
-import no.nav.testnav.libs.securitycore.domain.ServerProperties;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-@ConfigurationProperties(prefix = "consumers.testnav-miljoer-service")
-public class MiljoerServiceProperties extends ServerProperties {
-}
diff --git a/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/credentials/OrganisasjonServiceProperties.java b/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/credentials/OrganisasjonServiceProperties.java
deleted file mode 100644
index 5144fac42c3..00000000000
--- a/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/config/credentials/OrganisasjonServiceProperties.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package no.nav.registre.orgnrservice.config.credentials;
-
-
-import lombok.Getter;
-import lombok.Setter;
-import no.nav.testnav.libs.securitycore.domain.ServerProperties;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-
-@Setter
-@Getter
-@Configuration
-@ConfigurationProperties(prefix = "consumers.testnav-organisasjon-service")
-public class OrganisasjonServiceProperties extends ServerProperties {
- private Integer threads;
-}
diff --git a/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/consumer/OrganisasjonConsumer.java b/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/consumer/OrganisasjonConsumer.java
index 6c3f2c84034..ee5f741461d 100644
--- a/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/consumer/OrganisasjonConsumer.java
+++ b/apps/orgnummer-service/src/main/java/no/nav/registre/orgnrservice/consumer/OrganisasjonConsumer.java
@@ -1,10 +1,10 @@
package no.nav.registre.orgnrservice.consumer;
import lombok.extern.slf4j.Slf4j;
-import no.nav.registre.orgnrservice.config.credentials.MiljoerServiceProperties;
-import no.nav.registre.orgnrservice.config.credentials.OrganisasjonServiceProperties;
+import no.nav.registre.orgnrservice.config.Consumers;
import no.nav.registre.orgnrservice.consumer.command.GetOrganisasjonCommand;
import no.nav.registre.orgnrservice.consumer.command.MiljoerCommand;
+import no.nav.testnav.libs.securitycore.domain.ServerProperties;
import no.nav.testnav.libs.servletsecurity.exchange.TokenExchange;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.client.WebClient;
@@ -25,22 +25,22 @@ public class OrganisasjonConsumer {
private final WebClient organisasjonWebClient;
private final WebClient miljoerWebClient;
private final TokenExchange tokenExchange;
- private final MiljoerServiceProperties miljoerServiceProperties;
- private final OrganisasjonServiceProperties organisasjonServiceProperties;
+ private final ServerProperties miljoerServerProperties;
+ private final ServerProperties organisasjonServerProperties;
public OrganisasjonConsumer(
- MiljoerServiceProperties miljoerServiceProperties,
- OrganisasjonServiceProperties organisasjonServiceProperties,
+ Consumers consumers,
TokenExchange tokenExchange) {
-
- this.miljoerServiceProperties = miljoerServiceProperties;
- this.organisasjonServiceProperties = organisasjonServiceProperties;
+ miljoerServerProperties = consumers.getTestnavMiljoerService();
+ organisasjonServerProperties = consumers.getTestnavOrganisasjonService();
this.tokenExchange = tokenExchange;
- this.organisasjonWebClient = WebClient.builder()
- .baseUrl(organisasjonServiceProperties.getUrl())
+ this.organisasjonWebClient = WebClient
+ .builder()
+ .baseUrl(organisasjonServerProperties.getUrl())
.build();
- this.miljoerWebClient = WebClient.builder()
- .baseUrl(miljoerServiceProperties.getUrl())
+ this.miljoerWebClient = WebClient
+ .builder()
+ .baseUrl(miljoerServerProperties.getUrl())
.build();
}
@@ -52,8 +52,8 @@ private static boolean supportedEnv(String miljoe) {
public boolean finnesOrgnrIEreg(String orgnummer) {
var organisasjoner =
- Mono.zip(tokenExchange.exchange(miljoerServiceProperties),
- tokenExchange.exchange(organisasjonServiceProperties))
+ Mono.zip(tokenExchange.exchange(miljoerServerProperties),
+ tokenExchange.exchange(organisasjonServerProperties))
.flatMapMany(token -> new MiljoerCommand(miljoerWebClient, token.getT1().getTokenValue()).call()
.flatMapMany(miljoer -> Flux.fromIterable(Arrays.asList(miljoer))
.filter(OrganisasjonConsumer::supportedEnv)
diff --git a/apps/orgnummer-service/src/main/resources/application.yml b/apps/orgnummer-service/src/main/resources/application.yml
index 30c23da1782..2112fa117a2 100644
--- a/apps/orgnummer-service/src/main/resources/application.yml
+++ b/apps/orgnummer-service/src/main/resources/application.yml
@@ -35,7 +35,6 @@ consumers:
name: testnav-organisasjon-service
cluster: dev-gcp
namespace: dolly
- threads: 5
testnav-miljoer-service:
url: http://testnav-miljoer-service.dolly.svc.cluster.local
name: testnav-miljoer-service