package cn.zb.test; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import o ...
分类:
数据库 时间:
2019-06-02 10:29:15
阅读次数:
215
前言:现今SpringBoot、SpringCloud技术非常火热,作为Spring之上的框架,他们大量使用到了Spring的一些底层注解、原理,比如@Conditional、@Import、@EnableXXX等。如果掌握这些底层原理、注解,那么我们对这些高层框架就能做到高度定制,使用的游刃有余 ...
分类:
编程语言 时间:
2019-06-02 01:46:11
阅读次数:
143
知识点:Springboot2.0单元测试和自定义异常处理 1、@SpringBootTest单元测试 1)、引入相关依赖 2)、使用 3)单元测试注解 a )@Test b)@Before 在Test前执行 c)@After 在Test后执行 2、SpringBoot测试进阶之MockMvc类的使 ...
分类:
编程语言 时间:
2019-06-01 23:24:54
阅读次数:
206
知识点: 1、SpringBoot2.x服务端异常和SpringBoot配置全局异常 1)、默认异常测试 int i = 1/0,不友好 2)、异常注解介绍 @ControllerAdvice 如果是返回json数据 则用 RestControllerAdvice,就可以不加 @ResponseBo ...
分类:
编程语言 时间:
2019-06-01 23:18:08
阅读次数:
163
知识点:SpringBoot2.x使用Dev-tool工具热部署,快速加载启动应用 官方地址:https://docs.spring.io/spring-boot/docs/2.1.0.BUILD-SNAPSHOT/reference/htmlsingle/#using-boot-devtools ...
分类:
编程语言 时间:
2019-06-01 21:40:10
阅读次数:
147
如果本地安装了JDK,则在${java.home}/bin/下可找到jvisualvm.exe,双击打开即可使用。否则,去官网下载一个,解压即可使用。现有一个springboot程序springbootdemo.jar,使用JDK中jvisualvm的JMX方式监控该JVM 一、查询hostname ...
分类:
其他好文 时间:
2019-06-01 19:04:23
阅读次数:
99
知识点:SpringBoot2.x文件上传:HTML页面文件上传和后端处理 1、springboot文件上传 MultipartFile file,源自SpringMVC 1)静态页面直接访问:localhost:8080/index.html 注意点:如果想要直接访问html页面,则需要把html ...
分类:
编程语言 时间:
2019-05-31 21:43:42
阅读次数:
301
springboot访问mysql方式三:springboot+mybaitspom文件引入依赖<!--mybatis--><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId
分类:
数据库 时间:
2019-05-31 18:08:59
阅读次数:
119
有些情况接口需要返回的是xml数据 1、在springboot项目加入加入依赖jackson-dataformat-xml 2、在pojo层添加User类 3、在controller层添加UserController.java 启动醒目成功后,输入http://localhost:8080/json ...
分类:
编程语言 时间:
2019-05-31 16:54:20
阅读次数:
231
1、定时任务的创建方式: 基于注解@Schedule和,定时任务执行时间较短,并且比较单一 2、@Schedule和@EnableScheduling (1)在pom.xml中加入依赖 (2)在springboot的启动类DemoApplication上添加@EnableScheduling (3) ...
分类:
编程语言 时间:
2019-05-31 13:29:31
阅读次数:
133