From b6f64c1cb603796571a4bda2c060834e3443d7b1 Mon Sep 17 00:00:00 2001 From: Aman Verma Date: Fri, 4 Sep 2020 15:41:46 +0530 Subject: [PATCH 1/2] adding conditional property --- README.md | 7 ++++++- pom.xml | 2 +- .../azure/blobstorage/BlobServiceClientFactoryImpl.java | 2 ++ .../org/opengroup/osdu/azure/blobstorage/BlobStore.java | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9f4e93d6..8f3117fe 100644 --- a/README.md +++ b/README.md @@ -79,4 +79,9 @@ Enabled transaction logger and slf4jlogger | --- | --- | --- | | `tenantInfo.container.name` | `TenantInfo` | cosmos container name | | `azure.cosmosdb.database` | ex `dev-osdu-r2-db` | cosmos database name | -| `storage_account` | ex `testStorage` | storage account name | \ No newline at end of file + +## Settings to be added in application.properties to consume the BlobStore +| name | value | description | +| --- | --- | --- | +| `azure.blobStore.required` | `true` | - | +| `azure.storage.account-name` | ex `testStorage` | storage account name | diff --git a/pom.xml b/pom.xml index 7a97ede9..9ea43b81 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ org.opengroup.osdu core-lib-azure jar - 0.0.23 + 0.0.24 core-lib-azure diff --git a/src/main/java/org/opengroup/osdu/azure/blobstorage/BlobServiceClientFactoryImpl.java b/src/main/java/org/opengroup/osdu/azure/blobstorage/BlobServiceClientFactoryImpl.java index 72403bc6..20aa323f 100644 --- a/src/main/java/org/opengroup/osdu/azure/blobstorage/BlobServiceClientFactoryImpl.java +++ b/src/main/java/org/opengroup/osdu/azure/blobstorage/BlobServiceClientFactoryImpl.java @@ -20,12 +20,14 @@ import com.azure.storage.blob.BlobServiceClientBuilder; import org.opengroup.osdu.azure.di.BlobStoreConfiguration; import org.opengroup.osdu.common.Validators; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Component; /** * Implementation for IBlobServiceClientFactory. */ @Component +@ConditionalOnProperty(value = "azure.blobStore.required", havingValue = "true", matchIfMissing = false) public class BlobServiceClientFactoryImpl implements IBlobServiceClientFactory { private BlobServiceClient blobServiceClient; diff --git a/src/main/java/org/opengroup/osdu/azure/blobstorage/BlobStore.java b/src/main/java/org/opengroup/osdu/azure/blobstorage/BlobStore.java index fb2748f3..1bef8e11 100644 --- a/src/main/java/org/opengroup/osdu/azure/blobstorage/BlobStore.java +++ b/src/main/java/org/opengroup/osdu/azure/blobstorage/BlobStore.java @@ -22,6 +22,7 @@ import com.azure.storage.blob.specialized.BlockBlobClient; import org.opengroup.osdu.core.common.logging.ILogger; import org.opengroup.osdu.core.common.model.http.AppException; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; @@ -79,6 +80,7 @@ import java.util.Collections;; @Component @Lazy +@ConditionalOnProperty(value = "azure.blobStore.required", havingValue = "true", matchIfMissing = false) public class BlobStore { @Autowired -- GitLab From d096927c3b968609c1e94fb0d31df22c24c0cb98 Mon Sep 17 00:00:00 2001 From: Aman Verma Date: Fri, 4 Sep 2020 16:49:58 +0530 Subject: [PATCH 2/2] removing lazy --- .../java/org/opengroup/osdu/azure/blobstorage/BlobStore.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/opengroup/osdu/azure/blobstorage/BlobStore.java b/src/main/java/org/opengroup/osdu/azure/blobstorage/BlobStore.java index 1bef8e11..df5b1c04 100644 --- a/src/main/java/org/opengroup/osdu/azure/blobstorage/BlobStore.java +++ b/src/main/java/org/opengroup/osdu/azure/blobstorage/BlobStore.java @@ -23,7 +23,6 @@ import org.opengroup.osdu.core.common.logging.ILogger; import org.opengroup.osdu.core.common.model.http.AppException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import java.io.ByteArrayOutputStream; @@ -79,7 +78,6 @@ import java.util.Collections;; */ @Component -@Lazy @ConditionalOnProperty(value = "azure.blobStore.required", havingValue = "true", matchIfMissing = false) public class BlobStore { -- GitLab