diff --git a/README.md b/README.md index 9f4e93d6372c86ce2f30ca6f01abc62cc8303f6a..8f3117feeb63a1b1288b63e66a5c4775a8f06bd1 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 7a97ede97037d815b4c40508839673f18d6573a5..9ea43b81bf0b2cd7da63a18e534bcb070c24c031 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 72403bc6ee736018dbdb3daadead50f89255ca91..20aa323fa46799b1edb820c62c20ae7dc159dea5 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 fb2748f3f6fa3b38bad4f3a65cc61b3dbc433045..df5b1c04a6da4d0125f78b0f56e2e2206b8dd53a 100644 --- a/src/main/java/org/opengroup/osdu/azure/blobstorage/BlobStore.java +++ b/src/main/java/org/opengroup/osdu/azure/blobstorage/BlobStore.java @@ -22,7 +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.context.annotation.Lazy; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Component; import java.io.ByteArrayOutputStream; @@ -78,7 +78,7 @@ import java.util.Collections;; */ @Component -@Lazy +@ConditionalOnProperty(value = "azure.blobStore.required", havingValue = "true", matchIfMissing = false) public class BlobStore { @Autowired