-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Update readme for azure-spring-boot-starter-storage #23051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
backwind1233
merged 5 commits into
Azure:main
from
backwind1233:update_readme_azure-spring-boot-starter-storage
Jul 27, 2021
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -4,27 +4,13 @@ The project provides a Spring Boot Starter `azure-spring-boot-starter-storage` t | |
|
|
||
| [Package (Maven)][package] | [API reference documentation][refdocs] | [Product documentation][docs] | [Samples][sample] | ||
|
|
||
| ## Getting started | ||
|
|
||
| ### Prerequisites | ||
| - [Environment checklist][environment_checklist] | ||
|
|
||
| ### Include the package | ||
| 1. [Add azure-spring-boot-bom]. | ||
| 1. Add dependency. `<version>` can be skipped because we already add `azure-spring-boot-bom`. | ||
| ```xml | ||
| <dependency> | ||
| <groupId>com.azure.spring</groupId> | ||
| <artifactId>azure-spring-boot-starter-storage</artifactId> | ||
| </dependency> | ||
| ``` | ||
|
|
||
| ## Key concepts | ||
| The Azure Storage platform is Microsoft's cloud storage solution for modern data storage scenarios. Core storage services offer a massively scalable object store for data objects, disk storage for Azure virtual machines (VMs), a file system service for the cloud, a messaging store for reliable messaging, and a NoSQL store. | ||
| The [Azure Storage platform][azure_storage] is Microsoft's cloud storage solution for modern data storage scenarios. Core storage services offer a massively scalable object store for data objects, disk storage for Azure virtual machines (VMs), a file system service for the cloud, a messaging store for reliable messaging, and a NoSQL store. | ||
|
|
||
| ## Examples | ||
|
|
||
| Please use this `sample` as a reference for how to use **Azure Spring Boot Storage Starter** in your projects. | ||
| Please use this [sample][sample] as a reference for how to use **Azure Spring Boot Storage Starter** in your projects. | ||
|
chenrujun marked this conversation as resolved.
Outdated
|
||
|
|
||
| #### Auto-configuration for Azure Blob storage | ||
|
|
||
|
|
@@ -34,27 +20,34 @@ Name | Description | Required | |
| ---|---|--- | ||
| azure.storage.accountName | The name of the Azure Storage account. | Yes | | ||
| azure.storage.accountKey | The access key of the Azure Storage account. | Yes | | ||
| azure.storage.blob-endpoint | The blob endpoint URL of the Azure Storage account. | Optional when storage blob resource is used. | | ||
| azure.storage.file-endpoint | The file endpoint URL of the Azure Storage account. | Optional when storage file resource is used | | ||
| azure.storage.blob-endpoint | The blob endpoint URL of the Azure Storage account. | [Optional] Required when storage blob service is used. | | ||
| azure.storage.file-endpoint | The file endpoint URL of the Azure Storage account. | [Optional] Required when storage file service is used | | ||
|
|
||
| #### Autowire a resource | ||
| You can use the annotation of `@Value("blob://{containerName}/{blobName}")` to autowire a `Resource` with that in [Azure Blob storage][azure_storage]. | ||
| You can use the annotation of `@Value("azure-blob://[your-containerName]/[your-blobName]")` to autowire a **bolb** `Resource`. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spelling mistake - 'blob', not 'bolb'
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed, thanks @JonathanGiles |
||
|
|
||
| ```java | ||
| @Value("azure-blob://[your-containerName]/[your-blobName]") | ||
|
chenrujun marked this conversation as resolved.
Outdated
|
||
| private Resource storageResource; | ||
| ``` | ||
|
|
||
| You can use the annotation of `azure-file://[your-fileshareName]/[your-fileName]")` to autowire a **file** `Resource`. | ||
|
chenrujun marked this conversation as resolved.
Outdated
|
||
|
|
||
| ```java | ||
| @Value("blob://{containerName}/{blobName}") | ||
| private Resource blobFile; | ||
| @Value("azure-file://[your-fileshareName]/[your-fileName]") | ||
|
chenrujun marked this conversation as resolved.
Outdated
|
||
| private Resource storageResource; | ||
| ``` | ||
|
|
||
| #### Read and write to a resource | ||
| You can read a resource from Azure Blob storage with `getInputStream()` method. | ||
|
|
||
| ```java | ||
| this.blobFile.getInputStream(); | ||
| this.storageResource.getInputStream(); | ||
| ``` | ||
| You can write to a resource in Azure Blob storage by casting the Spring `Resource` to `WritableResource`. | ||
|
|
||
| ```java | ||
| (WritableResource) this.blobFile).getOutputStream(); | ||
| ((WritableResource) this.storageResource).getOutputStream()) | ||
|
chenrujun marked this conversation as resolved.
Outdated
|
||
| ``` | ||
|
|
||
| #### Other operations | ||
|
|
@@ -101,7 +94,7 @@ logging.level.org.hibernate=ERROR | |
| ``` | ||
|
|
||
| For more information about setting logging in spring, please refer to the [official doc][logging_doc]. | ||
|
|
||
| ## Next steps | ||
| The following section provide a sample project illustrating how to use the starter. | ||
| ### More sample code | ||
|
|
@@ -114,7 +107,7 @@ Please follow [instructions here][contributing_md] to build from source or contr | |
|
|
||
| <!-- Link --> | ||
| [docs]: https://docs.microsoft.com/azure/developer/java/spring-framework/configure-spring-boot-starter-java-app-with-azure-storage | ||
| [package]: https://mvnrepository.com/artifact/com.microsoft.azure/spring-starter-azure-storage | ||
| [package]: https://mvnrepository.com/artifact/com.azure.spring/azure-spring-boot-starter-storage | ||
| [refdocs]: https://azure.github.io/azure-sdk-for-java/springboot.html#azure-spring-boot | ||
| [src]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/azure-spring-boot-starter-storage | ||
| [sample]: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/main/storage/azure-spring-boot-sample-storage-resource | ||
|
|
@@ -123,7 +116,7 @@ Please follow [instructions here][contributing_md] to build from source or contr | |
| [contributing_md]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/spring/CONTRIBUTING.md | ||
| [maven]: https://maven.apache.org/ | ||
| [azure_blob_storage]: https://docs.microsoft.com/azure/storage/blobs/storage-blobs-introduction | ||
| [azure_storage]: https://azure.microsoft.com/services/storage/blobs/ | ||
| [azure_storage]: https://azure.microsoft.com/services/storage/ | ||
| [other_operation]: https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#resources | ||
| [environment_checklist]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/spring/ENVIRONMENT_CHECKLIST.md#ready-to-run-checklist | ||
| [Add azure-spring-boot-bom]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/spring/AZURE_SPRING_BOMS_USAGE.md#add-azure-spring-boot-bom | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.