Git Product home page Git Product logo

spring-todo-app's Introduction

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 [email protected] with any additional questions or comments.

Useful link

spring-todo-app's People

Contributors

microsoft-github-policy-service[bot] avatar microsoftopensource avatar msftgits avatar saragluna avatar selvasingh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-todo-app's Issues

Spring Data Cosmos DB not working

Java : 8 and 11

OS : ubuntu

get this error
java.lang.IllegalStateException: block()/blockFirst()/blockLast() are blocking, which is not supported in thread parallel-10

Mvn package run fails

Just followed instructions, got:

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.6.RELEASE:run (default-cli) on project spring-todo-app: An exception occurred while running. null: InvocationTargetException: Error creating bean with name 'todoListController': Unsatisfied dependency expressed through field 'todoItemRepository'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'todoItemRepository': Unsatisfied dependency expressed through method 'setDocumentDbOperations' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDbTemplate' defined in class path resource [com/microsoft/azure/spring/autoconfigure/cosmosdb/DocumentDBAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.microsoft.azure.spring.data.cosmosdb.core.DocumentDbTemplate]: Factory method 'documentDbTemplate' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDbFactory' defined in class path resource [com/microsoft/azure/spring/autoconfigure/cosmosdb/DocumentDBAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.microsoft.azure.spring.data.cosmosdb.DocumentDbFactory]: Factory method 'documentDbFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException: javax.xml.bind.JAXBException

I got this error , Changed to jdk 8 and still same thing

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.6.RELEASE:run (default-cli) on project spring-todo-app: An exception occurred while running. null: InvocationTargetException: Error creating bean with name 'todoListController': Unsatisfied dependency expressed through field 'todoItemRepository'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'todoItemRepository': Unsatisfied dependency expressed through method 'setDocumentDbOperations' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDbTemplate' defined in class path resource [com/microsoft/azure/spring/autoconfigure/cosmosdb/DocumentDBAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.microsoft.azure.spring.data.cosmosdb.core.DocumentDbTemplate]: Factory method 'documentDbTemplate' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'documentDbFactory' defined in class path resource [com/microsoft/azure/spring/autoconfigure/cosmosdb/DocumentDBAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.microsoft.azure.spring.data.cosmosdb.DocumentDbFactory]: Factory method 'documentDbFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException: javax.xml.bind.JAXBException ->

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.