diff --git a/README.md b/README.md
index bccbc21..26f5eb5 100644
--- a/README.md
+++ b/README.md
@@ -1,117 +1,121 @@
->转载请标明出处:
-> 原文首发于:https://www.fangzhipeng.com/springboot/2017/07/11/springboot-all/
-> 本文出自[方志朋的博客](https://www.fangzhipeng.com)
->
-
-
-
-
-
- 扫一扫,支持下作者吧
-
-
- (转载本站文章请注明作者和出处 方志朋的博客)
-
-
-
-
-# SpringBoot非官方教程 | 终章:文章汇总
-
- springboot非官方教程,可能最接近于官方的一个教程,大多数案例都来自于官方文档,为了更好的理解,加入了个人的改造。
-
-码云下载:[https://git.oschina.net/forezp/SpringBootLearning](https://git.oschina.net/forezp/SpringBootLearning)
-
- 源码下载:[https://github.com/forezp/SpringBootLearning](https://github.com/forezp/SpringBootLearning),谢谢支持,记得star哦。
-
-
-
-欢迎访问我的个人博客:https://www.fangzhipeng.com/springboot/2017/07/11/springboot-all/
-
-
-## 入门篇
-[SpringBoot非官方教程 | 第一篇:构建第一个SpringBoot工程](http://blog.csdn.net/forezp/article/details/70341651)
-
-## 配置篇
-
-[ SpringBoot非官方教程 | 第二篇:Spring Boot配置文件详解](http://blog.csdn.net/forezp/article/details/70437576)
-
-## 数据库篇
-
-[SpringBoot非官方教程 | 第三篇:SpringBoot用JdbcTemplates访问Mysql](http://blog.csdn.net/forezp/article/details/70477821)
-
-[SpringBoot非官方教程 | 第四篇:SpringBoot 整合JPA](http://blog.csdn.net/forezp/article/details/70545038)
-
-[SpringBoot非官方教程 | 第五篇:springboot整合 beatlsql](http://blog.csdn.net/forezp/article/details/70662983)
-
-[SpringBoot非官方教程 | 第六篇:springboot整合mybatis](http://blog.csdn.net/forezp/article/details/70768477)
-
-[SpringBoot非官方教程 | 第七篇:springboot开启声明式事务](http://blog.csdn.net/forezp/article/details/70833629)
-
-[SpringBoot非官方教程 | 第八篇:springboot整合mongodb](http://blog.csdn.net/forezp/article/details/70941577)
-
-[ SpringBoot非官方教程 | 第九篇: springboot整合Redis](http://blog.csdn.net/forezp/article/details/70991675)
-
-## 构架文档篇
-
-[SpringBoot非官方教程 | 第十篇: 用spring Restdocs创建API文档](http://blog.csdn.net/forezp/article/details/71023510)
-
-[ SpringBoot非官方教程 | 第十一篇:springboot集成swagger2,构建优雅的Restful API](http://blog.csdn.net/forezp/article/details/71023536)
-
-[SpringBoot非官方教程 | 第十二篇:springboot集成apidoc](http://blog.csdn.net/forezp/article/details/71023579)
-
-## 缓存篇
-[SpringBoot非官方教程 | 第十三篇:springboot集成spring cache](http://blog.csdn.net/forezp/article/details/71023614)
-
-## 消息队列
-
-[SpringBoot非官方教程 | 第十四篇:在springboot中用redis实现消息队列](http://blog.csdn.net/forezp/article/details/71023652)
-
-[ SpringBoot非官方教程 | 第十五篇:Springboot整合RabbitMQ](http://blog.csdn.net/forezp/article/details/71023692)
-
-## 网络相关
-
-[SpringBoot非官方教程 | 第十六篇:用restTemplate消费服务](http://blog.csdn.net/forezp/article/details/71023724)
-
-[SpringBoot非官方教程 | 第十七篇:上传文件](http://blog.csdn.net/forezp/article/details/71023752)
-
-## 任务调度
-
-[SpringBoot非官方教程 | 第十八篇: 定时任务(Scheduling Tasks)](http://blog.csdn.net/forezp/article/details/71023783)
-
-## 表单相关
-[SpringBoot非官方教程 | 第十九篇: 验证表单信息](http://blog.csdn.net/forezp/article/details/71023817)
-
-[SpringBoot非官方教程 | 第二十篇: 处理表单提交](http://blog.csdn.net/forezp/article/details/71023868)
-
-## 其他
-
-[ SpringBoot非官方教程 | 第二十一篇: springboot集成JMS](http://blog.csdn.net/forezp/article/details/71024024)
-
-[SpringBoot非官方教程 | 第二十二篇: 创建含有多module的springboot工程](http://blog.csdn.net/forezp/article/details/71024153)
-
-[ SpringBoot非官方教程 | 第二十三篇: 异步方法](http://blog.csdn.net/forezp/article/details/71024169)
-
-[ SpringBoot非官方教程 | 第二十四篇: springboot整合docker](http://blog.csdn.net/forezp/article/details/71024219)
-
-## 案例
-[ SpringBoot非官方教程 | 第二十五篇: 2小时学会springboot](http://blog.csdn.net/forezp/article/details/61472783)
-
-## 未完结
-* 待续。。。
-
-
-
-
-
- 扫码关注有惊喜
-
-
- (转载本站文章请注明作者和出处 方志朋的博客)
-
-
-
-
-
-
-
-
+>转载请标明出处:
+> 原文首发于:https://www.fangzhipeng.com/springboot/2017/07/11/springboot-all/
+> 本文出自[方志朋的博客](https://www.fangzhipeng.com)
+>
+
+
+
+
+
+ 扫一扫,支持下作者吧
+
+
+ (转载本站文章请注明作者和出处 方志朋的博客)
+
+
+
+
+# SpringBoot非官方教程 | 终章:文章汇总
+
+ springboot非官方教程,可能最接近于官方的一个教程,大多数案例都来自于官方文档,为了更好的理解,加入了个人的改造。
+
+码云下载:[https://git.oschina.net/forezp/SpringBootLearning](https://git.oschina.net/forezp/SpringBootLearning)
+
+ 源码下载:[https://github.com/forezp/SpringBootLearning](https://github.com/forezp/SpringBootLearning),谢谢支持,记得star哦。
+
+
+
+欢迎访问我的个人博客:https://www.fangzhipeng.com/springboot/2017/07/11/springboot-all/
+
+
+## 入门篇
+[SpringBoot非官方教程 | 第一篇:构建第一个SpringBoot工程](http://blog.csdn.net/forezp/article/details/70341651)
+
+## 配置篇
+
+[ SpringBoot非官方教程 | 第二篇:Spring Boot配置文件详解](http://blog.csdn.net/forezp/article/details/70437576)
+
+## 数据库篇
+
+[SpringBoot非官方教程 | 第三篇:SpringBoot用JdbcTemplates访问Mysql](http://blog.csdn.net/forezp/article/details/70477821)
+
+[SpringBoot非官方教程 | 第四篇:SpringBoot 整合JPA](http://blog.csdn.net/forezp/article/details/70545038)
+
+[SpringBoot非官方教程 | 第五篇:springboot整合 beatlsql](http://blog.csdn.net/forezp/article/details/70662983)
+
+[SpringBoot非官方教程 | 第六篇:springboot整合mybatis](http://blog.csdn.net/forezp/article/details/70768477)
+
+[SpringBoot非官方教程 | 第七篇:springboot开启声明式事务](http://blog.csdn.net/forezp/article/details/70833629)
+
+[SpringBoot非官方教程 | 第八篇:springboot整合mongodb](http://blog.csdn.net/forezp/article/details/70941577)
+
+[ SpringBoot非官方教程 | 第九篇: springboot整合Redis](http://blog.csdn.net/forezp/article/details/70991675)
+
+## 构架文档篇
+
+[SpringBoot非官方教程 | 第十篇: 用spring Restdocs创建API文档](http://blog.csdn.net/forezp/article/details/71023510)
+
+[ SpringBoot非官方教程 | 第十一篇:springboot集成swagger2,构建优雅的Restful API](http://blog.csdn.net/forezp/article/details/71023536)
+
+[SpringBoot非官方教程 | 第十二篇:springboot集成apidoc](http://blog.csdn.net/forezp/article/details/71023579)
+
+## 缓存篇
+[SpringBoot非官方教程 | 第十三篇:springboot集成spring cache](http://blog.csdn.net/forezp/article/details/71023614)
+
+## 消息队列
+
+[SpringBoot非官方教程 | 第十四篇:在springboot中用redis实现消息队列](http://blog.csdn.net/forezp/article/details/71023652)
+
+[ SpringBoot非官方教程 | 第十五篇:Springboot整合RabbitMQ](http://blog.csdn.net/forezp/article/details/71023692)
+
+## 网络相关
+
+[SpringBoot非官方教程 | 第十六篇:用restTemplate消费服务](http://blog.csdn.net/forezp/article/details/71023724)
+
+[SpringBoot非官方教程 | 第十七篇:上传文件](http://blog.csdn.net/forezp/article/details/71023752)
+
+## 任务调度
+
+[SpringBoot非官方教程 | 第十八篇: 定时任务(Scheduling Tasks)](http://blog.csdn.net/forezp/article/details/71023783)
+
+## 表单相关
+[SpringBoot非官方教程 | 第十九篇: 验证表单信息](http://blog.csdn.net/forezp/article/details/71023817)
+
+[SpringBoot非官方教程 | 第二十篇: 处理表单提交](http://blog.csdn.net/forezp/article/details/71023868)
+
+## 其他
+
+[ SpringBoot非官方教程 | 第二十一篇: springboot集成JMS](http://blog.csdn.net/forezp/article/details/71024024)
+
+[SpringBoot非官方教程 | 第二十二篇: 创建含有多module的springboot工程](http://blog.csdn.net/forezp/article/details/71024153)
+
+[ SpringBoot非官方教程 | 第二十三篇: 异步方法](http://blog.csdn.net/forezp/article/details/71024169)
+
+[ SpringBoot非官方教程 | 第二十四篇: springboot整合docker](http://blog.csdn.net/forezp/article/details/71024219)
+
+## 日志
+
+[springboot-log4j]
+
+## 案例
+[ SpringBoot非官方教程 | 第二十五篇: 2小时学会springboot](http://blog.csdn.net/forezp/article/details/61472783)
+
+## 未完结
+* 待续。。。
+
+
+
+
+
+ 扫码关注有惊喜
+
+
+ (转载本站文章请注明作者和出处 方志朋的博客)
+
+
+
+
+
+
+
+
diff --git a/springboot-cacahe-data-with-spring/pom.xml b/springboot-cacahe-data-with-spring/pom.xml
index 597b120..cb7aafc 100755
--- a/springboot-cacahe-data-with-spring/pom.xml
+++ b/springboot-cacahe-data-with-spring/pom.xml
@@ -1,57 +1,57 @@
-
-
- 4.0.0
-
- forezp
- demo
- 0.0.1-SNAPSHOT
- jar
-
-
-
- demo
- Demo project for Spring Boot
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.2.RELEASE
-
-
-
-
- UTF-8
- UTF-8
- 1.8
-
-
-
-
- org.springframework.boot
- spring-boot-starter
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
- org.springframework.boot
- spring-boot-starter-cache
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
-
+
+
+ 4.0.0
+
+ forezp
+ demo
+ 0.0.1-SNAPSHOT
+ jar
+
+
+
+ springboot-cache
+ Demo project for Spring Boot
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.5.2.RELEASE
+
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ org.springframework.boot
+ spring-boot-starter-cache
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+
diff --git a/springboot-cacahe-data-with-spring/src/main/java/forezp/DemoApplication.java b/springboot-cacahe-data-with-spring/src/main/java/forezp/DemoApplication.java
index fd7ba59..4b1aafb 100755
--- a/springboot-cacahe-data-with-spring/src/main/java/forezp/DemoApplication.java
+++ b/springboot-cacahe-data-with-spring/src/main/java/forezp/DemoApplication.java
@@ -1,14 +1,14 @@
-package forezp;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cache.annotation.EnableCaching;
-
-@SpringBootApplication
-@EnableCaching
-public class DemoApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(DemoApplication.class, args);
- }
-}
+package forezp;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cache.annotation.EnableCaching;
+
+@SpringBootApplication
+@EnableCaching
+public class DemoApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(DemoApplication.class, args);
+ }
+}
diff --git a/springboot-cacahe-data-with-spring/src/main/java/forezp/dao/impl/SimpleBookRepository.java b/springboot-cacahe-data-with-spring/src/main/java/forezp/dao/impl/SimpleBookRepository.java
index 1177272..7454d97 100755
--- a/springboot-cacahe-data-with-spring/src/main/java/forezp/dao/impl/SimpleBookRepository.java
+++ b/springboot-cacahe-data-with-spring/src/main/java/forezp/dao/impl/SimpleBookRepository.java
@@ -12,7 +12,7 @@
public class SimpleBookRepository implements BookRepository {
@Override
- @Cacheable("books")
+ @Cacheable("book")
public Book getByIsbn(String isbn) {
simulateSlowService();
return new Book(isbn, "Some book");
diff --git a/springboot-config/src/main/java/com/forezp/bean/ConfigBean.java b/springboot-config/src/main/java/com/forezp/bean/ConfigBean.java
index 4e36fc6..aa9956c 100755
--- a/springboot-config/src/main/java/com/forezp/bean/ConfigBean.java
+++ b/springboot-config/src/main/java/com/forezp/bean/ConfigBean.java
@@ -1,13 +1,14 @@
package com.forezp.bean;
import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
+import org.springframework.context.annotation.Configuration;
/**
- * Created by fangzhipeng on 2017年4月18日.
+ * fixed by shangxl on 2019年03月27日
*/
@ConfigurationProperties(prefix = "my")
-@Component
+//@Configuration其实内部就是@Component
+@Configuration
public class ConfigBean {
private String name;
diff --git a/springboot-config/src/main/java/com/forezp/web/LucyController.java b/springboot-config/src/main/java/com/forezp/web/LucyController.java
index d58cf56..5216667 100755
--- a/springboot-config/src/main/java/com/forezp/web/LucyController.java
+++ b/springboot-config/src/main/java/com/forezp/web/LucyController.java
@@ -11,7 +11,6 @@
* Created by fangzhipeng on 2017年4月18日.
*/
@RestController
-@EnableConfigurationProperties({ConfigBean.class,User.class})
public class LucyController {
@Autowired
ConfigBean configBean;
diff --git a/springboot-first-application/src/main/java/com/forezp/web/HelloController.java b/springboot-first-application/src/main/java/com/forezp/web/HelloController.java
index 54ee5d4..6922d48 100755
--- a/springboot-first-application/src/main/java/com/forezp/web/HelloController.java
+++ b/springboot-first-application/src/main/java/com/forezp/web/HelloController.java
@@ -1,6 +1,8 @@
package com.forezp.web;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -12,8 +14,11 @@
@RestController
public class HelloController {
+ private Logger logger = LoggerFactory.getLogger(this.getClass());
+
@RequestMapping("/")
public String index() {
+ logger.info("shangxol--------------->");
return "Greetings from Spring Boot!";
}
diff --git a/springboot-first-application/src/main/resources/application.properties b/springboot-first-application/src/main/resources/application.properties
deleted file mode 100755
index e69de29..0000000
diff --git a/springboot-first-application/src/main/resources/application.yml b/springboot-first-application/src/main/resources/application.yml
new file mode 100644
index 0000000..fd39205
--- /dev/null
+++ b/springboot-first-application/src/main/resources/application.yml
@@ -0,0 +1,5 @@
+logging:
+ level:
+ root: error # ��������spriingboot�ܹ���info�������־
+ com.forezp.web: debug
+ file: ${user.home}/logs/hello.log # ����־��ӡ��ָ�����ļ���
\ No newline at end of file
diff --git a/springboot-jpa/src/main/java/com/forezp/dao/AccountDao.java b/springboot-jpa/src/main/java/com/forezp/dao/AccountDao.java
index cdf1da9..6deaece 100755
--- a/springboot-jpa/src/main/java/com/forezp/dao/AccountDao.java
+++ b/springboot-jpa/src/main/java/com/forezp/dao/AccountDao.java
@@ -6,5 +6,6 @@
/**
* Created by fangzhipeng on 2017年4月20日.
*/
+
public interface AccountDao extends JpaRepository {
}
diff --git a/springboot-jpa/src/main/resources/application.yml b/springboot-jpa/src/main/resources/application.yml
index cebb7d1..f37609c 100755
--- a/springboot-jpa/src/main/resources/application.yml
+++ b/springboot-jpa/src/main/resources/application.yml
@@ -3,7 +3,7 @@ spring:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
username: root
- password: 123456
+ password: root
jpa:
hibernate:
diff --git a/springboot-mongodb/src/main/resources/application.properties b/springboot-mongodb/src/main/resources/application.properties
index 544e3ff..40676ba 100755
--- a/springboot-mongodb/src/main/resources/application.properties
+++ b/springboot-mongodb/src/main/resources/application.properties
@@ -1 +1 @@
-spring.data.mongodb.uri=mongodb://localhost:27017/springboot-db
+spring.data.mongodb.uri=mongodb://root:root@localhost:27017/shangxol-db
diff --git a/springboot-mybatis-tx/src/main/java/com/forezp/service/AccountService2.java b/springboot-mybatis-tx/src/main/java/com/forezp/service/AccountService2.java
index d214abf..b161535 100755
--- a/springboot-mybatis-tx/src/main/java/com/forezp/service/AccountService2.java
+++ b/springboot-mybatis-tx/src/main/java/com/forezp/service/AccountService2.java
@@ -16,8 +16,8 @@ public class AccountService2 {
@Transactional
public void transfer() throws RuntimeException{
- accountMapper2.update(90,1);//用户1减10块 用户2加10块
+ accountMapper2.update(10,2);//用户1减10块 用户2加10块
int i=1/0;
- accountMapper2.update(110,2);
+ accountMapper2.update(11,3);
}
}
diff --git a/springboot-mybatis-tx/src/main/resources/application.properties b/springboot-mybatis-tx/src/main/resources/application.properties
index 259b7ed..24c0de2 100755
--- a/springboot-mybatis-tx/src/main/resources/application.properties
+++ b/springboot-mybatis-tx/src/main/resources/application.properties
@@ -1,6 +1,6 @@
-spring.datasource.url=jdbc:mysql://localhost:3306/test
+spring.datasource.url=jdbc:mysql://localhost:3306/react-load
spring.datasource.username=root
-spring.datasource.password=123456
+spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
mybatis.mapper-locations=classpath*:mybatis/*Mapper.xml
mybatis.type-aliases-package=com.forezp.entity
\ No newline at end of file
diff --git a/springboot-mybatis/pom.xml b/springboot-mybatis/pom.xml
index d7ff404..f871a41 100755
--- a/springboot-mybatis/pom.xml
+++ b/springboot-mybatis/pom.xml
@@ -1,66 +1,73 @@
-
-
- 4.0.0
-
- com.forezp
- springboot-mybatis
- 0.0.1-SNAPSHOT
- jar
-
- springboot-mybatis
- Demo project for Spring Boot
-
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.2.RELEASE
-
-
-
-
- UTF-8
- UTF-8
- 1.8
-
-
-
-
- org.mybatis.spring.boot
- mybatis-spring-boot-starter
- 1.3.0
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- mysql
- mysql-connector-java
- runtime
-
-
- com.alibaba
- druid
- 1.0.29
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
-
+
+
+ 4.0.0
+
+ com.forezp
+ springboot-mybatis
+ 0.0.1-SNAPSHOT
+ jar
+
+ springboot-mybatis
+ Demo project for Spring Boot
+
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.5.2.RELEASE
+
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+
+
+
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 1.3.0
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ mysql
+ mysql-connector-java
+ runtime
+
+
+ com.alibaba
+ druid
+ 1.0.29
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+
diff --git a/springboot-mybatis/src/main/java/com/forezp/entity/Account.java b/springboot-mybatis/src/main/java/com/forezp/entity/Account.java
index 989505f..0c3697d 100755
--- a/springboot-mybatis/src/main/java/com/forezp/entity/Account.java
+++ b/springboot-mybatis/src/main/java/com/forezp/entity/Account.java
@@ -1,43 +1,15 @@
package com.forezp.entity;
+import lombok.Data;
+import lombok.ToString;
+
/**
* Created by fangzhipeng on 2017年4月20日.
*/
+@Data
+@ToString
public class Account {
private int id ;
private String name ;
private double money;
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public double getMoney() {
- return money;
- }
-
- public void setMoney(double money) {
- this.money = money;
- }
-
- @Override
- public String toString() {
- return "Account{" +
- "id=" + id +
- ", name='" + name + '\'' +
- ", money=" + money +
- '}';
- }
}
diff --git a/springboot-mybatis/src/main/java/com/forezp/web/AccountController.java b/springboot-mybatis/src/main/java/com/forezp/web/AccountController.java
index c1ce47a..e1a02b8 100755
--- a/springboot-mybatis/src/main/java/com/forezp/web/AccountController.java
+++ b/springboot-mybatis/src/main/java/com/forezp/web/AccountController.java
@@ -17,17 +17,17 @@ public class AccountController {
@Autowired
AccountService accountService;
- @RequestMapping(value = "/list", method = RequestMethod.GET)
+ @GetMapping(value = "/list")
public List getAccounts() {
return accountService.findAccountList();
}
- @RequestMapping(value = "/{id}", method = RequestMethod.GET)
+ @GetMapping(value = "/{id}")
public Account getAccountById(@PathVariable("id") int id) {
return accountService.findAccount(id);
}
- @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
+ @PutMapping(value = "/{id}")
public String updateAccount(@PathVariable("id") int id, @RequestParam(value = "name", required = true) String name,
@RequestParam(value = "money", required = true) double money) {
int t= accountService.update(name,money,id);
@@ -39,7 +39,7 @@ public String updateAccount(@PathVariable("id") int id, @RequestParam(value = "n
}
- @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
+ @DeleteMapping(value = "/{id}")
public String delete(@PathVariable(value = "id")int id) {
int t= accountService.delete(id);
if(t==1) {
@@ -50,7 +50,7 @@ public String delete(@PathVariable(value = "id")int id) {
}
- @RequestMapping(value = "", method = RequestMethod.POST)
+ @PostMapping(value = "")
public String postAccount(@RequestParam(value = "name") String name,
@RequestParam(value = "money") double money) {
diff --git a/springboot-mybatis/src/main/resources/application.properties b/springboot-mybatis/src/main/resources/application.properties
index 448604e..d750cfc 100755
--- a/springboot-mybatis/src/main/resources/application.properties
+++ b/springboot-mybatis/src/main/resources/application.properties
@@ -1,4 +1,4 @@
-spring.datasource.url=jdbc:mysql://localhost:3306/test
+spring.datasource.url=jdbc:mysql://localhost:3306/react-load
spring.datasource.username=root
-spring.datasource.password=123456
+spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
diff --git a/springboot-redis-message/src/main/java/com/forezp/SpringbootRedisApplication.java b/springboot-redis-message/src/main/java/com/forezp/SpringbootRedisApplication.java
index 10e3c74..cda7af6 100755
--- a/springboot-redis-message/src/main/java/com/forezp/SpringbootRedisApplication.java
+++ b/springboot-redis-message/src/main/java/com/forezp/SpringbootRedisApplication.java
@@ -1,73 +1,73 @@
-package com.forezp;
-
-import com.forezp.message.Receiver;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import java.util.concurrent.CountDownLatch;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.data.redis.connection.RedisConnectionFactory;
-import org.springframework.data.redis.core.StringRedisTemplate;
-import org.springframework.data.redis.listener.PatternTopic;
-import org.springframework.data.redis.listener.RedisMessageListenerContainer;
-import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
-
-@SpringBootApplication
-public class SpringbootRedisApplication {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(SpringbootRedisApplication.class);
-
- @Bean
- RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory,
- MessageListenerAdapter listenerAdapter) {
-
- RedisMessageListenerContainer container = new RedisMessageListenerContainer();
- container.setConnectionFactory(connectionFactory);
- container.addMessageListener(listenerAdapter, new PatternTopic("chat"));
-
- return container;
- }
-
- @Bean
- MessageListenerAdapter listenerAdapter(Receiver receiver) {
- return new MessageListenerAdapter(receiver, "receiveMessage");
- }
-
- @Bean
- Receiver receiver(CountDownLatch latch) {
- return new Receiver(latch);
- }
-
- @Bean
- CountDownLatch latch() {
- return new CountDownLatch(1);
- }
-
- @Bean
- StringRedisTemplate template(RedisConnectionFactory connectionFactory) {
- return new StringRedisTemplate(connectionFactory);
- }
-
- public static void main(String[] args) throws Exception{
- ApplicationContext ctx = SpringApplication.run(SpringbootRedisApplication.class, args);
-
- StringRedisTemplate template = ctx.getBean(StringRedisTemplate.class);
- CountDownLatch latch = ctx.getBean(CountDownLatch.class);
-
- LOGGER.info("Sending message...");
- template.convertAndSend("chat", "Hello from Redis!");
-
- latch.await();
-
- System.exit(0);
- }
-
-
- /**
- * 2017年04月20日 17:25:15.536 INFO 39148 --- [ main] com.forezp.SpringbootRedisApplication : Sending message...
- * 2017年04月20日 17:25:15.544 INFO 39148 --- [ container-2] com.forezp.message.Receiver : Received
- */
-}
+package com.forezp;
+
+import com.forezp.message.Receiver;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import java.util.concurrent.CountDownLatch;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.data.redis.listener.PatternTopic;
+import org.springframework.data.redis.listener.RedisMessageListenerContainer;
+import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
+
+@SpringBootApplication
+public class SpringbootRedisApplication {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(SpringbootRedisApplication.class);
+
+ @Bean
+ RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory,
+ MessageListenerAdapter listenerAdapter) {
+
+ RedisMessageListenerContainer container = new RedisMessageListenerContainer();
+ container.setConnectionFactory(connectionFactory);
+ container.addMessageListener(listenerAdapter, new PatternTopic("chat"));
+
+ return container;
+ }
+
+ @Bean
+ MessageListenerAdapter listenerAdapter(Receiver receiver) {
+ return new MessageListenerAdapter(receiver, "receiveMessage");
+ }
+
+ @Bean
+ Receiver receiver(CountDownLatch latch) {
+ return new Receiver(latch);
+ }
+
+ @Bean
+ CountDownLatch latch() {
+ return new CountDownLatch(1);
+ }
+
+ @Bean
+ StringRedisTemplate template(RedisConnectionFactory connectionFactory) {
+ return new StringRedisTemplate(connectionFactory);
+ }
+
+ public static void main(String[] args) throws Exception{
+ ApplicationContext ctx = SpringApplication.run(SpringbootRedisApplication.class, args);
+
+ StringRedisTemplate template = ctx.getBean(StringRedisTemplate.class);
+ CountDownLatch latch = ctx.getBean(CountDownLatch.class);
+
+ LOGGER.info("Sending message...");
+ template.convertAndSend("chat", "Hello from Redis!");
+
+ latch.await();
+
+ System.exit(0);
+ }
+
+
+ /**
+ * 2017年04月20日 17:25:15.536 INFO 39148 --- [ main] com.forezp.SpringbootRedisApplication : Sending message...
+ * 2017年04月20日 17:25:15.544 INFO 39148 --- [ container-2] com.forezp.message.Receiver : Received
+ */
+}
diff --git a/springboot-redis-message/src/main/resources/application.properties b/springboot-redis-message/src/main/resources/application.properties
index 31fa2ba..9f88002 100755
--- a/springboot-redis-message/src/main/resources/application.properties
+++ b/springboot-redis-message/src/main/resources/application.properties
@@ -1,7 +1,7 @@
spring.redis.host=localhost
spring.redis.port=6379
-#spring.redis.password=
-spring.redis.database=1
+spring.redis.password=Credit2016Admin
+spring.redis.database=0
spring.redis.pool.max-active=8
spring.redis.pool.max-wait=-1
spring.redis.pool.max-idle=500
diff --git a/springboot-redis-message/src/test/java/com/forezp/SpringbootRedisApplicationTests.java b/springboot-redis-message/src/test/java/com/forezp/SpringbootRedisApplicationTests.java
index 8b14870..a161dd3 100755
--- a/springboot-redis-message/src/test/java/com/forezp/SpringbootRedisApplicationTests.java
+++ b/springboot-redis-message/src/test/java/com/forezp/SpringbootRedisApplicationTests.java
@@ -1,30 +1,30 @@
-package com.forezp;
-
-import com.forezp.dao.RedisDao;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class SpringbootRedisApplicationTests {
-
- public static Logger logger= LoggerFactory.getLogger(SpringbootRedisApplicationTests.class);
- @Test
- public void contextLoads() {
- }
-
- @Autowired
- RedisDao redisDao;
- @Test
- public void testRedis(){
- redisDao.setKey("name","forezp");
- redisDao.setKey("age","11");
- logger.info(redisDao.getValue("name"));
- logger.info(redisDao.getValue("age"));
- }
-}
+package com.forezp;
+
+import com.forezp.dao.RedisDao;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class SpringbootRedisApplicationTests {
+
+ public static Logger logger= LoggerFactory.getLogger(SpringbootRedisApplicationTests.class);
+ @Test
+ public void contextLoads() {
+ }
+
+ @Autowired
+ RedisDao redisDao;
+ @Test
+ public void testRedis(){
+ redisDao.setKey("name","forezp");
+ redisDao.setKey("age","11");
+ logger.info(redisDao.getValue("name"));
+ logger.info(redisDao.getValue("age"));
+ }
+}
diff --git a/springboot-restdocs/src/test/java/com/forezp/SpringbootRestdocsApplicationTests.java b/springboot-restdocs/src/test/java/com/forezp/SpringbootRestdocsApplicationTests.java
index cb96820..372de2c 100755
--- a/springboot-restdocs/src/test/java/com/forezp/SpringbootRestdocsApplicationTests.java
+++ b/springboot-restdocs/src/test/java/com/forezp/SpringbootRestdocsApplicationTests.java
@@ -1,16 +1,16 @@
-package com.forezp;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class SpringbootRestdocsApplicationTests {
-
- @Test
- public void contextLoads() {
- }
-
-}
+package com.forezp;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class SpringbootRestdocsApplicationTests {
+
+ @Test
+ public void contextLoads() {
+ }
+
+}
diff --git a/springboot-resttemplate/pom.xml b/springboot-resttemplate/pom.xml
index 92b1631..636e22e 100755
--- a/springboot-resttemplate/pom.xml
+++ b/springboot-resttemplate/pom.xml
@@ -1,52 +1,52 @@
-
-
- 4.0.0
-
- com.forezp
- springboot-resttemplate
- 0.0.1-SNAPSHOT
- jar
-
- springboot-resttemplate
- Demo project for Spring Boot
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.2.RELEASE
-
-
-
-
- UTF-8
- UTF-8
- 1.8
-
-
-
-
- org.springframework.boot
- spring-boot-starter
-
-
- org.springframework
- spring-web
-
-
- com.fasterxml.jackson.core
- jackson-databind
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
-
+
+
+ 4.0.0
+
+ com.forezp
+ springboot-resttemplate
+ 0.0.1-SNAPSHOT
+ jar
+
+ springboot-resttemplate
+ Demo project for Spring Boot
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.5.2.RELEASE
+
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.springframework
+ spring-web
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+
diff --git a/springboot-resttemplate/src/main/java/com/forezp/SpringbootResttemplateApplication.java b/springboot-resttemplate/src/main/java/com/forezp/SpringbootResttemplateApplication.java
index 2842606..23b2e3d 100755
--- a/springboot-resttemplate/src/main/java/com/forezp/SpringbootResttemplateApplication.java
+++ b/springboot-resttemplate/src/main/java/com/forezp/SpringbootResttemplateApplication.java
@@ -1,41 +1,41 @@
-package com.forezp;
-
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.boot.CommandLineRunner;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.web.client.RestTemplateBuilder;
-import org.springframework.context.annotation.Bean;
-import org.springframework.web.client.RestTemplate;
-
-@SpringBootApplication
-public class SpringbootResttemplateApplication {
-
- private static final Logger log = LoggerFactory.getLogger(SpringbootResttemplateApplication.class);
-
-// public static void main(String args[]) {
-// RestTemplate restTemplate = new RestTemplate();
-// String quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", String.class);
-// log.info(quote.toString());
-// }
-
- public static void main(String args[]) {
- SpringApplication.run(SpringbootResttemplateApplication.class);
- }
-
- @Bean
- public RestTemplate restTemplate(RestTemplateBuilder builder) {
- return builder.build();
- }
-
- @Bean
- public CommandLineRunner run(RestTemplate restTemplate) throws Exception {
- return args -> {
- String quote = restTemplate.getForObject(
- "http://gturnquist-quoters.cfapps.io/api/random", String.class);
- log.info(quote.toString());
- };
- }
-}
+package com.forezp;
+
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.web.client.RestTemplate;
+
+@SpringBootApplication
+public class SpringbootResttemplateApplication {
+
+ private static final Logger log = LoggerFactory.getLogger(SpringbootResttemplateApplication.class);
+
+// public static void main(String args[]) {
+// RestTemplate restTemplate = new RestTemplate();
+// String quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", String.class);
+// log.info(quote.toString());
+// }
+
+ public static void main(String args[]) {
+ SpringApplication.run(SpringbootResttemplateApplication.class);
+ }
+
+ @Bean
+ public RestTemplate restTemplate(RestTemplateBuilder builder) {
+ return builder.build();
+ }
+
+ @Bean
+ public CommandLineRunner run(RestTemplate restTemplate) throws Exception {
+ return args -> {
+ String quote = restTemplate.getForObject(
+ "http://gturnquist-quoters.cfapps.io/api/random", String.class);
+ log.info(quote.toString());
+ };
+ }
+}
diff --git a/springboot-resttemplate/src/test/java/com/forezp/SpringbootResttemplateApplicationTests.java b/springboot-resttemplate/src/test/java/com/forezp/SpringbootResttemplateApplicationTests.java
index 5c5bfe2..8a5bfa1 100755
--- a/springboot-resttemplate/src/test/java/com/forezp/SpringbootResttemplateApplicationTests.java
+++ b/springboot-resttemplate/src/test/java/com/forezp/SpringbootResttemplateApplicationTests.java
@@ -1,2 +1,2 @@
-package com.forezp;
-
+package com.forezp;
+
diff --git a/springboot-scheduling-tasks/pom.xml b/springboot-scheduling-tasks/pom.xml
index 9a61ab4..f7dbd06 100755
--- a/springboot-scheduling-tasks/pom.xml
+++ b/springboot-scheduling-tasks/pom.xml
@@ -1,50 +1,50 @@
-
-
- 4.0.0
-
- com.forezp
- springboot-scheduling-tasks
- 0.0.1-SNAPSHOT
- jar
-
- springboot-scheduling-tasks
- Demo project for Spring Boot
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.2.RELEASE
-
-
-
-
- UTF-8
- UTF-8
- 1.8
-
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
-
+
+
+ 4.0.0
+
+ com.forezp
+ springboot-scheduling-tasks
+ 0.0.1-SNAPSHOT
+ jar
+
+ springboot-scheduling-tasks
+ Demo project for Spring Boot
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.5.2.RELEASE
+
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+
diff --git a/springboot-scheduling-tasks/src/main/java/com/forezp/SpringbootSchedulingTasksApplication.java b/springboot-scheduling-tasks/src/main/java/com/forezp/SpringbootSchedulingTasksApplication.java
index 135fd67..81ce99e 100755
--- a/springboot-scheduling-tasks/src/main/java/com/forezp/SpringbootSchedulingTasksApplication.java
+++ b/springboot-scheduling-tasks/src/main/java/com/forezp/SpringbootSchedulingTasksApplication.java
@@ -1,14 +1,14 @@
-package com.forezp;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.scheduling.annotation.EnableScheduling;
-
-@SpringBootApplication
-@EnableScheduling
-public class SpringbootSchedulingTasksApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(SpringbootSchedulingTasksApplication.class, args);
- }
-}
+package com.forezp;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+@SpringBootApplication
+@EnableScheduling
+public class SpringbootSchedulingTasksApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SpringbootSchedulingTasksApplication.class, args);
+ }
+}
diff --git a/springboot-scheduling-tasks/src/test/java/com/forezp/SpringbootSchedulingTasksApplicationTests.java b/springboot-scheduling-tasks/src/test/java/com/forezp/SpringbootSchedulingTasksApplicationTests.java
index dadfd7d..6a0748d 100755
--- a/springboot-scheduling-tasks/src/test/java/com/forezp/SpringbootSchedulingTasksApplicationTests.java
+++ b/springboot-scheduling-tasks/src/test/java/com/forezp/SpringbootSchedulingTasksApplicationTests.java
@@ -1,16 +1,16 @@
-package com.forezp;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class SpringbootSchedulingTasksApplicationTests {
-
- @Test
- public void contextLoads() {
- }
-
-}
+package com.forezp;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class SpringbootSchedulingTasksApplicationTests {
+
+ @Test
+ public void contextLoads() {
+ }
+
+}
diff --git a/springboot-swagger/pom.xml b/springboot-swagger/pom.xml
index c6363ad..e4aabf9 100755
--- a/springboot-swagger/pom.xml
+++ b/springboot-swagger/pom.xml
@@ -1,69 +1,69 @@
-
-
- 4.0.0
-
-
- com.forezp
- chapter3
- 0.0.1-SNAPSHOT
- jar
-
- chapter3
- Demo project for Spring Boot
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.2.RELEASE
-
-
-
-
- UTF-8
- UTF-8
- 1.8
-
-
-
-
- org.springframework.boot
- spring-boot-starter
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
-
- io.springfox
- springfox-swagger2
- 2.6.1
-
-
-
- io.springfox
- springfox-swagger-ui
- 2.6.1
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
-
+
+
+ 4.0.0
+
+
+ com.forezp
+ chapter3
+ 0.0.1-SNAPSHOT
+ jar
+
+ chapter3
+ Demo project for Spring Boot
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.5.2.RELEASE
+
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+
+ io.springfox
+ springfox-swagger2
+ 2.6.1
+
+
+
+ io.springfox
+ springfox-swagger-ui
+ 2.6.1
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+
diff --git a/springboot-swagger/src/main/java/com/forezp/Chapter3Application.java b/springboot-swagger/src/main/java/com/forezp/Chapter3Application.java
index 1ef89de..7dda995 100755
--- a/springboot-swagger/src/main/java/com/forezp/Chapter3Application.java
+++ b/springboot-swagger/src/main/java/com/forezp/Chapter3Application.java
@@ -1,12 +1,12 @@
-package com.forezp;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-
-@SpringBootApplication
-public class Chapter3Application {
-
- public static void main(String[] args) {
- SpringApplication.run(Chapter3Application.class, args);
- }
-}
+package com.forezp;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Chapter3Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Chapter3Application.class, args);
+ }
+}
diff --git a/springboot-swagger/src/test/java/com/forezp/Chapter3ApplicationTests.java b/springboot-swagger/src/test/java/com/forezp/Chapter3ApplicationTests.java
index c296e2d..344de88 100755
--- a/springboot-swagger/src/test/java/com/forezp/Chapter3ApplicationTests.java
+++ b/springboot-swagger/src/test/java/com/forezp/Chapter3ApplicationTests.java
@@ -1,16 +1,16 @@
-package com.forezp;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class Chapter3ApplicationTests {
-
- @Test
- public void contextLoads() {
- }
-
-}
+package com.forezp;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class Chapter3ApplicationTests {
+
+ @Test
+ public void contextLoads() {
+ }
+
+}
diff --git a/springboot-upload-file/pom.xml b/springboot-upload-file/pom.xml
index 401da4a..2e4206a 100755
--- a/springboot-upload-file/pom.xml
+++ b/springboot-upload-file/pom.xml
@@ -1,55 +1,55 @@
-
-
- 4.0.0
-
- com.forezp
- springboot-upload-file
- 0.0.1-SNAPSHOT
- jar
-
- springboot-upload-file
- Demo project for Spring Boot
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 1.5.2.RELEASE
-
-
-
-
- UTF-8
- UTF-8
- 1.8
-
-
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
- org.springframework.boot
- spring-boot-starter-thymeleaf
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
-
-
-
+
+
+ 4.0.0
+
+ com.forezp
+ springboot-upload-file
+ 0.0.1-SNAPSHOT
+ jar
+
+ springboot-upload-file
+ Demo project for Spring Boot
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.5.2.RELEASE
+
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
+
diff --git a/springboot-upload-file/src/main/java/com/forezp/SpringbootUploadFileApplication.java b/springboot-upload-file/src/main/java/com/forezp/SpringbootUploadFileApplication.java
index 76b2392..15150f3 100755
--- a/springboot-upload-file/src/main/java/com/forezp/SpringbootUploadFileApplication.java
+++ b/springboot-upload-file/src/main/java/com/forezp/SpringbootUploadFileApplication.java
@@ -1,26 +1,26 @@
-package com.forezp;
-
-import com.forezp.storage.StorageProperties;
-import com.forezp.storage.StorageService;
-import org.springframework.boot.CommandLineRunner;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-
-@SpringBootApplication
-@EnableConfigurationProperties(StorageProperties.class)
-public class SpringbootUploadFileApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(SpringbootUploadFileApplication.class, args);
- }
-
- @Bean
- CommandLineRunner init(StorageService storageService) {
- return (args) -> {
- storageService.deleteAll();
- storageService.init();
- };
- }
-}
+package com.forezp;
+
+import com.forezp.storage.StorageProperties;
+import com.forezp.storage.StorageService;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+
+@SpringBootApplication
+@EnableConfigurationProperties(StorageProperties.class)
+public class SpringbootUploadFileApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(SpringbootUploadFileApplication.class, args);
+ }
+
+ @Bean
+ CommandLineRunner init(StorageService storageService) {
+ return (args) -> {
+ storageService.deleteAll();
+ storageService.init();
+ };
+ }
+}
diff --git a/springboot-upload-file/src/main/java/com/forezp/storage/FileSystemStorageService.java b/springboot-upload-file/src/main/java/com/forezp/storage/FileSystemStorageService.java
index 708e379..bd0000e 100755
--- a/springboot-upload-file/src/main/java/com/forezp/storage/FileSystemStorageService.java
+++ b/springboot-upload-file/src/main/java/com/forezp/storage/FileSystemStorageService.java
@@ -1,86 +1,86 @@
-package com.forezp.storage;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.UrlResource;
-import org.springframework.stereotype.Service;
-import org.springframework.util.FileSystemUtils;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.stream.Stream;
-
-@Service
-public class FileSystemStorageService implements StorageService {
-
- private final Path rootLocation;
-
- @Autowired
- public FileSystemStorageService(StorageProperties properties) {
- this.rootLocation = Paths.get(properties.getLocation());
- }
-
- @Override
- public void store(MultipartFile file) {
- try {
- if (file.isEmpty()) {
- throw new StorageException("Failed to store empty file " + file.getOriginalFilename());
- }
- Files.copy(file.getInputStream(), this.rootLocation.resolve(file.getOriginalFilename()));
- } catch (IOException e) {
- throw new StorageException("Failed to store file " + file.getOriginalFilename(), e);
- }
- }
-
- @Override
- public Stream loadAll() {
- try {
- return Files.walk(this.rootLocation, 1)
- .filter(path -> !path.equals(this.rootLocation))
- .map(path -> this.rootLocation.relativize(path));
- } catch (IOException e) {
- throw new StorageException("Failed to read stored files", e);
- }
-
- }
-
- @Override
- public Path load(String filename) {
- return rootLocation.resolve(filename);
- }
-
- @Override
- public Resource loadAsResource(String filename) {
- try {
- Path file = load(filename);
- Resource resource = new UrlResource(file.toUri());
- if(resource.exists() || resource.isReadable()) {
- return resource;
- }
- else {
- throw new StorageFileNotFoundException("Could not read file: " + filename);
-
- }
- } catch (MalformedURLException e) {
- throw new StorageFileNotFoundException("Could not read file: " + filename, e);
- }
- }
-
- @Override
- public void deleteAll() {
- FileSystemUtils.deleteRecursively(rootLocation.toFile());
- }
-
- @Override
- public void init() {
- try {
- Files.createDirectory(rootLocation);
- } catch (IOException e) {
- throw new StorageException("Could not initialize storage", e);
- }
- }
-}
+package com.forezp.storage;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.UrlResource;
+import org.springframework.stereotype.Service;
+import org.springframework.util.FileSystemUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.stream.Stream;
+
+@Service
+public class FileSystemStorageService implements StorageService {
+
+ private final Path rootLocation;
+
+ @Autowired
+ public FileSystemStorageService(StorageProperties properties) {
+ this.rootLocation = Paths.get(properties.getLocation());
+ }
+
+ @Override
+ public void store(MultipartFile file) {
+ try {
+ if (file.isEmpty()) {
+ throw new StorageException("Failed to store empty file " + file.getOriginalFilename());
+ }
+ Files.copy(file.getInputStream(), this.rootLocation.resolve(file.getOriginalFilename()));
+ } catch (IOException e) {
+ throw new StorageException("Failed to store file " + file.getOriginalFilename(), e);
+ }
+ }
+
+ @Override
+ public Stream loadAll() {
+ try {
+ return Files.walk(this.rootLocation, 1)
+ .filter(path -> !path.equals(this.rootLocation))
+ .map(path -> this.rootLocation.relativize(path));
+ } catch (IOException e) {
+ throw new StorageException("Failed to read stored files", e);
+ }
+
+ }
+
+ @Override
+ public Path load(String filename) {
+ return rootLocation.resolve(filename);
+ }
+
+ @Override
+ public Resource loadAsResource(String filename) {
+ try {
+ Path file = load(filename);
+ Resource resource = new UrlResource(file.toUri());
+ if(resource.exists() || resource.isReadable()) {
+ return resource;
+ }
+ else {
+ throw new StorageFileNotFoundException("Could not read file: " + filename);
+
+ }
+ } catch (MalformedURLException e) {
+ throw new StorageFileNotFoundException("Could not read file: " + filename, e);
+ }
+ }
+
+ @Override
+ public void deleteAll() {
+ FileSystemUtils.deleteRecursively(rootLocation.toFile());
+ }
+
+ @Override
+ public void init() {
+ try {
+ Files.createDirectory(rootLocation);
+ } catch (IOException e) {
+ throw new StorageException("Could not initialize storage", e);
+ }
+ }
+}
diff --git a/springboot-upload-file/src/main/java/com/forezp/storage/StorageException.java b/springboot-upload-file/src/main/java/com/forezp/storage/StorageException.java
index 33c5f29..7dfecf9 100755
--- a/springboot-upload-file/src/main/java/com/forezp/storage/StorageException.java
+++ b/springboot-upload-file/src/main/java/com/forezp/storage/StorageException.java
@@ -1,12 +1,12 @@
-package com.forezp.storage;
-
-public class StorageException extends RuntimeException {
-
- public StorageException(String message) {
- super(message);
- }
-
- public StorageException(String message, Throwable cause) {
- super(message, cause);
- }
-}
+package com.forezp.storage;
+
+public class StorageException extends RuntimeException {
+
+ public StorageException(String message) {
+ super(message);
+ }
+
+ public StorageException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/springboot-upload-file/src/main/java/com/forezp/storage/StorageFileNotFoundException.java b/springboot-upload-file/src/main/java/com/forezp/storage/StorageFileNotFoundException.java
index 2b7c3ed..883f4d5 100755
--- a/springboot-upload-file/src/main/java/com/forezp/storage/StorageFileNotFoundException.java
+++ b/springboot-upload-file/src/main/java/com/forezp/storage/StorageFileNotFoundException.java
@@ -1,12 +1,12 @@
-package com.forezp.storage;
-
-public class StorageFileNotFoundException extends StorageException {
-
- public StorageFileNotFoundException(String message) {
- super(message);
- }
-
- public StorageFileNotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
+package com.forezp.storage;
+
+public class StorageFileNotFoundException extends StorageException {
+
+ public StorageFileNotFoundException(String message) {
+ super(message);
+ }
+
+ public StorageFileNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
\ No newline at end of file
diff --git a/springboot-upload-file/src/main/java/com/forezp/storage/StorageProperties.java b/springboot-upload-file/src/main/java/com/forezp/storage/StorageProperties.java
index b2835f5..e906b90 100755
--- a/springboot-upload-file/src/main/java/com/forezp/storage/StorageProperties.java
+++ b/springboot-upload-file/src/main/java/com/forezp/storage/StorageProperties.java
@@ -1,21 +1,21 @@
-package com.forezp.storage;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties("storage")
-public class StorageProperties {
-
- /**
- * Folder location for storing files
- */
- private String location = "upload-dir";
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
-}
+package com.forezp.storage;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+@ConfigurationProperties("storage")
+public class StorageProperties {
+
+ /**
+ * Folder location for storing files
+ */
+ private String location = "upload-dir";
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+}
diff --git a/springboot-upload-file/src/main/java/com/forezp/storage/StorageService.java b/springboot-upload-file/src/main/java/com/forezp/storage/StorageService.java
index c3676e5..fc9f3ca 100755
--- a/springboot-upload-file/src/main/java/com/forezp/storage/StorageService.java
+++ b/springboot-upload-file/src/main/java/com/forezp/storage/StorageService.java
@@ -1,23 +1,23 @@
-package com.forezp.storage;
-
-import org.springframework.core.io.Resource;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.nio.file.Path;
-import java.util.stream.Stream;
-
-public interface StorageService {
-
- void init();
-
- void store(MultipartFile file);
-
- Stream loadAll();
-
- Path load(String filename);
-
- Resource loadAsResource(String filename);
-
- void deleteAll();
-
-}
+package com.forezp.storage;
+
+import org.springframework.core.io.Resource;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.nio.file.Path;
+import java.util.stream.Stream;
+
+public interface StorageService {
+
+ void init();
+
+ void store(MultipartFile file);
+
+ Stream loadAll();
+
+ Path load(String filename);
+
+ Resource loadAsResource(String filename);
+
+ void deleteAll();
+
+}
diff --git a/springboot-upload-file/src/main/resources/application.properties b/springboot-upload-file/src/main/resources/application.properties
index 8fc6eec..6395714 100755
--- a/springboot-upload-file/src/main/resources/application.properties
+++ b/springboot-upload-file/src/main/resources/application.properties
@@ -1,2 +1,2 @@
-spring.http.multipart.max-file-size=128KB
-spring.http.multipart.max-request-size=128KB
\ No newline at end of file
+spring.http.multipart.max-file-size=1024KB
+spring.http.multipart.max-request-size=1024KB
\ No newline at end of file
diff --git a/springboot-upload-file/src/main/resources/templates/uploadForm.html b/springboot-upload-file/src/main/resources/templates/uploadForm.html
index 0676314..f995599 100755
--- a/springboot-upload-file/src/main/resources/templates/uploadForm.html
+++ b/springboot-upload-file/src/main/resources/templates/uploadForm.html
@@ -18,9 +18,9 @@
-