Coder Social home page Coder Social logo

lrrp / java-springboot-quickstart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from couchbase-examples/java-springboot-quickstart

0.0 0.0 0.0 178 KB

Entry level Couchbase Java Spring Boot tutorial/demo. Steps to build a REST API to manage user profile CRUD operations..

License: Other

Shell 4.38% Java 94.54% HTML 1.09%

java-springboot-quickstart's Introduction

Quickstart in Couchbase with Java and Spring Boot

Build a REST API with Couchbase's Java SDK 3 and Spring Boot

This repo is designed to teach you how to connect to a Couchbase cluster to create, read, update, and delete documents and how to write simple parametrized N1QL queries.

Try it now!

Full documentation can be found on the Couchbase Developer Portal.

Prerequisites

To run this prebuilt project, you will need:

  • Couchbase Server 7 Installed (version 7.0.0-5247 or higher)
  • Java SDK v1.8 or higher installed
  • Code Editor installed (IntelliJ IDEA, Eclipse, or Visual Studio Code)
  • Maven command line

Install Dependencies

mvn package

Note: Maven packages auto restore when building the project in IntelliJ IDEA or Eclipse depending on IDE configuration.

Database Server Configuration

All configuration for communication with the database is stored in the /src/main/resources/application.properties file. This includes the connection string, username, and password. The default username is assumed to be Administrator and the default password is assumed to be password. If these are different in your environment you will need to change them before running the application.

Dependency Injection via DBSetupRunner class

The quickstart code provides a CommandLineRunner called DBSetupRunner in the runners folder that wires up the Bucket and Cluster objects for dependency injection. This runner also creates the bucket, collection, scope, and indexes for the tutorial to run properly automatically when the application

Running The Application

At this point the application is ready and you can run it via your IDE or from the terminal:

mvn spring-boot:run -e -X

You can launch your browser and go to the Swagger start page.

Running The Tests

To run the standard integration tests (which requires a running Couchbase Server), use the following command:

mvn verify

Project Setup Notes

This project was based on the standard Spring Boot project. The HealthCheckController is provided as a sanity check and is used in integration tests.

A full list of packages are referenced in the pom.xml file

Conclusion

Setting up a basic REST API in Spring Boot with Couchbase is fairly simple. This project when run with Couchbase Server 7 installed creates a bucket in Couchbase, an index for our parameterized N1QL query, and showcases basic CRUD operations needed in most applications.

java-springboot-quickstart's People

Contributors

biozal avatar jdmuntacb avatar chedim avatar dependabot[bot] avatar deniswsrosa avatar sermiribrahim avatar nebasuke avatar ejscribner avatar dnault avatar

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.