项目作者: jcalvopinam

项目描述 :
Reactive Couchbase Sample
高级语言: Java
项目地址: git://github.com/jcalvopinam/sample-couchbase-rx.git
创建时间: 2018-08-26T03:05:17Z
项目社区:https://github.com/jcalvopinam/sample-couchbase-rx

开源协议:MIT License

下载


Reactive Couchbase with Webflux and Spring Boot Sample - WIP

This is a basic sample of Reactive Couchbase with Webflux and Spring Boot, I used the following technologies:

  • Spring Boot 2.0.4.RELEASE
  • Spring Data Couchbase 3.0.9.RELEASE
  • Spring Webflux 5.0.8.RELEASE
  • Couchbase Database 5.5.0
  • Apache Maven 3.3.9

How to run?

I only implemented the find method to access to the database, all CRUD methods have yet to be implemented,
therefore to reproduce this sample you have to create a document manually in the database.

I use docker, if you want to use it, you can copy and paste the following command in your terminal:

  1. docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 couchbase

or else just open the couchbase ui in your browser and login with your credentials:

  1. http://localhost:8091/ui/index.html
  • Create a new bucket called sample
  • Open the sample bucket documents and create a new one, copy and paste this snippet of code in json
    1. {
    2. "id": "1",
    3. "name": "Juan",
    4. "lastName": "Calvopina",
    5. "addresses": [
    6. {
    7. "code": "A1",
    8. "mainStreet": "AAA",
    9. "secondStreet": "BBB",
    10. "phone": "11111"
    11. }
    12. ],
    13. "classType": "com.jcalvopinam.model.Person"
    14. }
    This code snippet has the same mapping used in the model com.jcalvopinam.model.Person.java
  • Create a new user on Security tab called sample with password password and give it full access
  • Clone the project and open it in your IDE
  • Download dependencies with maven: mvn clean install at the end you should see [INFO] BUILD SUCCESS
  • Run the main class: SampleCouchbaseRxApplication.java
  • Open a new tab in your browser and use the following endpoint:
  1. http://localhost:8080/people/1/addresses
  • Finally you should get something like this:
  1. [
  2. {
  3. "id":"1",
  4. "addresses":[
  5. {
  6. "mainStreet":"AAA",
  7. "secondStreet":"BBB",
  8. "phone":"11111"
  9. }
  10. ]
  11. }
  12. ]

P.D. This is still process, I will continue to implementing the missing methods to have the full sample of CRUD