Spring Boot TODO app
Перейти к файлу
Xiaolu Dai a88eee0adf
Merge pull request #8 from microsoft/users/GitHubPolicyService/d2777514-cb9d-4a78-9175-c26fd7e0fd7b
Adding Microsoft SECURITY.MD
2022-09-02 09:28:06 +08:00
src Format the logger content; due to the bug https://github.com/Azure/azure-sdk-for-java/issues/20727, use 'deleteById(ID id, PartitionKey partitionKey)' method instead 'deleteById(ID id)' 2021-05-31 15:04:04 +08:00
.gitignore Spring TODO App code (#1) 2018-10-28 12:55:48 -07:00
LICENSE Initial commit 2018-10-20 09:22:24 -07:00
README.md Update dependencies version up to date. 2021-05-28 13:34:28 +08:00
SECURITY.md Microsoft mandatory file 2022-08-17 14:51:44 +00:00
checkstyle-suppressions.xml Update dependencies version up to date. 2021-05-28 13:34:28 +08:00
checkstyle.xml Update dependencies version up to date. 2021-05-28 13:34:28 +08:00
mvnw Spring TODO App code (#1) 2018-10-28 12:55:48 -07:00
mvnw.cmd Spring TODO App code (#1) 2018-10-28 12:55:48 -07:00
pom.xml update group id 2021-05-28 13:56:12 +08:00
set-env-variables-template.sh Update dependencies version up to date. 2021-05-28 13:34:28 +08:00

README.md

Spring Todo App

This Spring TODO app is a Java application built using Spring Boot, Spring Data for Cosmos DB and Azure Cosmos DB.

Requirements

| Azure CLI | Java 8 | Maven 3 | Git |

Create Azure Cosmos DB

Create Azure Cosmos DB using Azure CLI 2.0

STEP A - LOGIN to Azure

Login your Azure CLI, and set your subscription

az login
az account set -s <your-subscription-id>

STEP B - Create Resource Group

Create an Azure Resource Group, and note down the resource group name

az group create -n <your-azure-group-name> \
    -l <your-resource-group-region>

STEP C - Create COSMOS DB

Create Azure Cosmos DB with GlobalDocumentDB kind. The name of Cosmos DB must use only lower case letters. Note down the documentEndpoint field in the response

az cosmosdb create --kind GlobalDocumentDB \
    -g <your-azure-group-name> \
    -n <your-azure-COSMOS-DB-name-in-lower-case-letters>

STEP D - Get COSMOS DB Key

Get your Azure Cosmos DB key, get the primaryMasterKey

az cosmosdb list-keys -g <your-azure-group-name> -n <your-azure-COSMOSDB-name>

Running Spring TODO App locally

STEP 1 - Checkout Spring TODO app

git clone https://github.com/Microsoft/spring-todo-app.git
cd spring-todo-ap

STEP 2 - Configure the app

Set environment variables using a script file. Start with the supplied template in the repo:

cp set-env-variables-template.sh .scripts/set-env-variables.sh

Edit .scripts/set-env-variables.sh and supply Azure Cosmos DB connection info. Particularly:

export COSMOS_URI=<put-your-COSMOS-DB-documentEndpoint-URI-here>
export COSMOS_KEY=<put-your-COSMOS-DB-primaryMasterKey-here>
export COSMOS_DATABASE=<put-your-COSMOS-DATABASE-name-here>

Set environment variables:

source .scripts/set-env-variables.sh

STEP 3 - Run Spring TODO App locally

mvn package spring-boot:run

You can access Spring TODO App here: http://localhost:8080/.

Clean up

You can delete Azure resources that you created deleting the Azure Resource Group:

az group delete -y --no-wait -n <your-resource-group-name>

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.