From 7d6e48a4a1744c4e30c972ea1471b880b9f18c6b Mon Sep 17 00:00:00 2001
From: shuzheng <469741414@qq.com>
Date: Tue, 22 Nov 2016 15:39:14 +0800
Subject: [PATCH] update
---
.gitignore | 3 ++-
README.md | 8 ++++----
springboot/pom.xml | 5 -----
.../zheng/springboot/web/HelloController.java | 18 +++++++++++++++++-
.../main/resources/application-dev.properties | 1 +
.../main/resources/application-prod.properties | 1 +
.../main/resources/application-test.properties | 1 +
.../src/main/resources/application.properties | 3 +++
.../src/main/resources/templates/index.html | 8 +++++++-
.../com/zheng/SpringbootApplicationTests.java | 5 ++---
10 files changed, 38 insertions(+), 15 deletions(-)
create mode 100644 springboot/src/main/resources/application-dev.properties
create mode 100644 springboot/src/main/resources/application-prod.properties
create mode 100644 springboot/src/main/resources/application-test.properties
diff --git a/.gitignore b/.gitignore
index e5aa5b3c..5201bbfb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
.idea
*.iml
-target
\ No newline at end of file
+target
+.log
\ No newline at end of file
diff --git a/README.md b/README.md
index 61b61396..8bcfaee6 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,10 @@ zheng
| ├── qa-dao
| ├── qa-service
| └── qa-web
+├── upms 通用用户权限系统
+| ├── upms-dao
+| ├── upms-service
+| └── upms-admin
├── pay 支付系统
| ├── pay-service
| ├── pay-sdk
@@ -28,10 +32,6 @@ zheng
| └── wechat-app 小程序
| ├── wechat-app-sdk
| └── wechat-app-example
-├── upms 通用用户权限系统
-| ├── upms-dao
-| ├── upms-service
-| └── upms-admin
├── api 接口系统
└── oss 对象存储系统
├── oss-sdk
diff --git a/springboot/pom.xml b/springboot/pom.xml
index 3833ac1d..85bd9368 100644
--- a/springboot/pom.xml
+++ b/springboot/pom.xml
@@ -83,11 +83,6 @@
org.springframework.boot
spring-boot-starter-redis
-
-
- org.springframework.boot
- spring-boot-starter-data-mongodb
-
diff --git a/springboot/src/main/java/com/zheng/springboot/web/HelloController.java b/springboot/src/main/java/com/zheng/springboot/web/HelloController.java
index 6edd7bfd..393308e9 100644
--- a/springboot/src/main/java/com/zheng/springboot/web/HelloController.java
+++ b/springboot/src/main/java/com/zheng/springboot/web/HelloController.java
@@ -1,5 +1,6 @@
package com.zheng.springboot.web;
+import com.zheng.springboot.domain.User;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
@@ -7,6 +8,9 @@ import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* Created by ZhangShuzheng on 2016/11/16.
*/
@@ -15,9 +19,21 @@ public class HelloController {
@ApiOperation(value="测试首页", notes="测试首页get请求")
@ApiImplicitParam(name = "map", value = "ModelMap实体map", required = false, dataType = "ModelMap")
- @RequestMapping(value = "/index", method = RequestMethod.GET)
+ @RequestMapping(value = "/hello", method = RequestMethod.GET)
public String index(ModelMap map) {
map.addAttribute("host", "http://www.zhangshuzheng.cn");
+ List users = new ArrayList<>();
+ User user = new User();
+ user.setId(null);
+ user.setAge(11);
+ user.setName("");
+ users.add(user);
+ user = new User();
+ user.setId(2l);
+ user.setAge(22);
+ user.setName("lisi");
+ users.add(user);
+ map.addAttribute("users", users);
return "/index";
}
diff --git a/springboot/src/main/resources/application-dev.properties b/springboot/src/main/resources/application-dev.properties
new file mode 100644
index 00000000..baede636
--- /dev/null
+++ b/springboot/src/main/resources/application-dev.properties
@@ -0,0 +1 @@
+profile.env=dev
\ No newline at end of file
diff --git a/springboot/src/main/resources/application-prod.properties b/springboot/src/main/resources/application-prod.properties
new file mode 100644
index 00000000..bb7a8fdf
--- /dev/null
+++ b/springboot/src/main/resources/application-prod.properties
@@ -0,0 +1 @@
+profile.env=prod
\ No newline at end of file
diff --git a/springboot/src/main/resources/application-test.properties b/springboot/src/main/resources/application-test.properties
new file mode 100644
index 00000000..4ff006f4
--- /dev/null
+++ b/springboot/src/main/resources/application-test.properties
@@ -0,0 +1 @@
+profile.env=test
\ No newline at end of file
diff --git a/springboot/src/main/resources/application.properties b/springboot/src/main/resources/application.properties
index 6b5ef92c..baad1508 100644
--- a/springboot/src/main/resources/application.properties
+++ b/springboot/src/main/resources/application.properties
@@ -1,3 +1,6 @@
+########## ##########
+spring.profiles.active=dev
+evn=${profile.env}
########## Դ ##########
#spring.datasource.url=jdbc:mysql://localhost:3306/zheng
#spring.datasource.username=root
diff --git a/springboot/src/main/resources/templates/index.html b/springboot/src/main/resources/templates/index.html
index e8bd4618..abc0342e 100644
--- a/springboot/src/main/resources/templates/index.html
+++ b/springboot/src/main/resources/templates/index.html
@@ -1,10 +1,16 @@
-
+
Hello World
+
\ No newline at end of file
diff --git a/springboot/src/test/java/com/zheng/SpringbootApplicationTests.java b/springboot/src/test/java/com/zheng/SpringbootApplicationTests.java
index 762558c9..8509c9f3 100644
--- a/springboot/src/test/java/com/zheng/SpringbootApplicationTests.java
+++ b/springboot/src/test/java/com/zheng/SpringbootApplicationTests.java
@@ -1,7 +1,6 @@
package com.zheng;
import com.zheng.springboot.SpringbootApplication;
-import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -20,8 +19,8 @@ public class SpringbootApplicationTests {
public void contextLoads() {
System.out.println("=============================== redis start ===============================");
// 保存字符串
- stringRedisTemplate.opsForValue().set("aaa", "111");
- Assert.assertEquals("111", stringRedisTemplate.opsForValue().get("aaa"));
+// stringRedisTemplate.opsForValue().set("aaa", "111");
+// Assert.assertEquals("111", stringRedisTemplate.opsForValue().get("aaa"));
System.out.println("=============================== redis end ===============================");
}