This commit is contained in:
shuzheng 2016-11-22 15:39:14 +08:00
parent 55b669ea92
commit 7d6e48a4a1
10 changed files with 38 additions and 15 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.idea
*.iml
target
.log

View File

@ -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

View File

@ -83,11 +83,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
</dependency>
<!-- mongodb -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -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<User> 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";
}

View File

@ -0,0 +1 @@
profile.env=dev

View File

@ -0,0 +1 @@
profile.env=prod

View File

@ -0,0 +1 @@
profile.env=test

View File

@ -1,3 +1,6 @@
########## »·¾³ ##########
spring.profiles.active=dev
evn=${profile.env}
########## 单数据源 ##########
#spring.datasource.url=jdbc:mysql://localhost:3306/zheng
#spring.datasource.username=root

View File

@ -1,10 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<meta charset="UTF-8"/>
<title></title>
</head>
<body>
<h1 th:text="${host}">Hello World</h1>
<ul th:each="user : ${users}">
<li th:text="${user.id}"></li>
<li th:text="${user.age}"></li>
<li th:text="${user.name}"></li>
</ul>
</body>
</html>

View File

@ -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 ===============================");
}