摘要: JDK8的新特性——Lambda表达式 JDK8已经发布快4年的时间了,现在来谈它的新特性显得略微的有点“不合时宜”。尽管JDK8已不再“新”,但它的重要特性之一——Lambda表达式依然是不被大部分开发者所熟练运用,甚至不被开发者所熟知。 国内的开发环境大家都知道,有各种的老项目,有各种各样的发布 阅读全文
posted @ 2019-02-27 20:57 咫尺天涯是路人丶 阅读(240) 评论(0) 推荐(0) 编辑
摘要: Scheduled 定时任务器:是 Spring3.0 以后自带的一个定时任务器。 1、在pom.xml文件中添加Scheduled依赖 <!-- 添加spring定时任务 Scheduled 坐标 --> <dependency> <groupId>org.springframework</gro 阅读全文
posted @ 2019-02-24 18:36 咫尺天涯是路人丶 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 1、创建maven项目,修改pom.xml文件 <!--springboot项目依赖的父项目--> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifac 阅读全文
posted @ 2019-02-24 18:35 咫尺天涯是路人丶 阅读(260) 评论(0) 推荐(0) 编辑
摘要: spring为开发者提供了一个名为spring-boot-devtools的模块来使Spring Boot应用支持热部署,提高开发者的开发效率,无需手动重启Spring Boot应用。 devtools的原理 深层原理是使用了两个ClassLoader,一个Classloader加载那些不会改变的类 阅读全文
posted @ 2019-02-24 18:35 咫尺天涯是路人丶 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 修改异常处理方法3中的全局异常处理Controller即可 package bjsxt.exception; import org.springframework.context.annotation.Bean; import org.springframework.context.annotati 阅读全文
posted @ 2019-02-24 18:33 咫尺天涯是路人丶 阅读(317) 评论(0) 推荐(0) 编辑
摘要: 修改异常处理方式4中的全局异常处理controller package com.bjsxt.exception; import org.springframework.context.annotation.Bean; import org.springframework.context.annota 阅读全文
posted @ 2019-02-24 18:33 咫尺天涯是路人丶 阅读(712) 评论(0) 推荐(0) 编辑
摘要: 问题:使用@ExceptionHandle注解需要在每一个controller代码里面都添加异常处理,会咋成代码冗余 解决方法:新建一个全局异常处理类,添加@ControllerAdvice注解即可 package com.bjsxt.exception; import org.springfram 阅读全文
posted @ 2019-02-24 18:32 咫尺天涯是路人丶 阅读(379) 评论(0) 推荐(0) 编辑
摘要: 1、编写controller package com.bjsxt.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.Exceptio 阅读全文
posted @ 2019-02-24 18:31 咫尺天涯是路人丶 阅读(699) 评论(0) 推荐(0) 编辑
摘要: 需求:通过使用 SpringBoot+SpringMVC+MyBatis 整合实现一个对数据库中的 t_user 表的 CRUD 的操作 1、创建maven项目,添加项目所需依赖 <!--springboot项目依赖的父项目--> <parent> <groupId>org.springframew 阅读全文
posted @ 2019-02-24 18:29 咫尺天涯是路人丶 阅读(159) 评论(0) 推荐(0) 编辑
摘要: SpringBoot 默认的处理异常的机制:SpringBoot 默认的已经提供了一套处理异常的机制。一旦程序中出现了异常 SpringBoot 会向/error 的 url 发送请求。在 springBoot 中提供了一个叫 BasicExceptionController 来处理/error 请 阅读全文
posted @ 2019-02-24 18:29 咫尺天涯是路人丶 阅读(348) 评论(0) 推荐(0) 编辑