From 62a79fa73e20a44112b0a454803a4bb00e1920bc Mon Sep 17 00:00:00 2001 From: Xiong Neng Date: Sat, 15 Sep 2018 13:49:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90springboot-mongodb=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- springboot-mongodb/README.md | 18 +++++++++++++--- .../src/main/resources/application.yml | 21 +------------------ 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/springboot-mongodb/README.md b/springboot-mongodb/README.md index e00789a..9ac43c7 100644 --- a/springboot-mongodb/README.md +++ b/springboot-mongodb/README.md @@ -4,9 +4,22 @@ SpringBoot集成MongoDB访问NoSQL数据库 ## 安装MongoDB数据库 -数据库的安装教程网上非常多,参考 [官网安装](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/) +数据库的安装教程网上非常多,我在CentOS7上面安装,版本是4.0 +参考了 [官网安装](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/) -配置数据库的账号和密码。 +安装完成后,配置数据库的账号和密码: + +``` +mongo --port 27017 +use test +db.createUser( + { + user: "xiongneng", + pwd: "123456", + roles: [ { role: "readWrite", db: "test" } ] + } + ) +``` ## 修改application.yml @@ -16,7 +29,6 @@ SpringBoot集成MongoDB访问NoSQL数据库 执行对用户表增/删/改/查的测试用例:`com.xncoding.pos.ApplicationTests.java` - ## 许可证 Copyright (c) 2018 Xiong Neng diff --git a/springboot-mongodb/src/main/resources/application.yml b/springboot-mongodb/src/main/resources/application.yml index f135207..b21adf8 100644 --- a/springboot-mongodb/src/main/resources/application.yml +++ b/springboot-mongodb/src/main/resources/application.yml @@ -23,23 +23,4 @@ logging: ROOT: INFO com: xncoding: DEBUG - file: E:/logs/app.log - ---- - -##################################################################### -######################## 测试环境profile ########################## -##################################################################### - -spring: - profiles: test - data: - mongodb: - uri: mongodb://xiongneng:123456@localhost:27017/test - -logging: - level: - ROOT: INFO - com: - xncoding: DEBUG - file: /var/logs/app.log + file: D:/logs/app.log