Spring常用注解 本文枚举一些常用的SpringBoot开发注解,希望能帮助读者在SpringBoot开发中正确地使用注解。 @Spring Application 主程序注解,spring框架的main函数自带注解。一般不需要开发人员操作,Spring Initializer会写好。 @Con ...
分类:
编程语言 时间:
2021-02-06 12:01:01
阅读次数:
0
目标: 1. 什么是AOP, 什么是AspectJ 2. 什么是Spring AOP 3. Spring AOP注解版实现原理 4. Spring AOP切面原理解析 一. 认识AOP及其使用 详见博文1: 5.1 Spring5源码--Spring AOP源码分析一 二. AOP的特点 2.1 S ...
分类:
编程语言 时间:
2021-02-05 11:01:07
阅读次数:
0
SpringBoot actuator(自定义端点类) 1、编写自动端点类很简单,只需要在类前面使用@Endpoint注解 EndPoint中id 来表示url路径 2、使用@ReadOperation //显示监控指标 3、使用@WriteOperation //动态修改指标,以post方式修改 ...
分类:
编程语言 时间:
2021-02-05 10:47:22
阅读次数:
0
@ControllerAdvice,顾名思义,这是一个增强的 Controller。使用这个 Controller ,可以实现三个方面的功能: 全局异常处理 全局数据绑定 全局数据预处理 全局异常处理 使用 @ControllerAdvice 实现全局异常处理,只需要定义类,添加该注解即可定义方式如 ...
分类:
其他好文 时间:
2021-02-05 10:33:02
阅读次数:
0
RestController和Controller的区别 @RestController = @ResponseBody + @Controller 如果只是使用@RestController注解Controller,则Controller中的方法无法返回jsp页面,或者html,配置的视图解析器 ...
分类:
编程语言 时间:
2021-02-04 12:13:15
阅读次数:
0
现象:eclipse中在对象上使用lombok的@Data,引用get方法时,没有set、get方法。 解决办法: 1.在lombok官网(https://www.projectlombok.org/download)下载lombok的jar包 2.把jar包放到eclipse同目录文件夹 3.双击 ...
分类:
系统相关 时间:
2021-02-04 12:01:51
阅读次数:
0
Spring Cloud 是目前最火的微服务框架,Feign 作为基础组件之一,在 Spring Cloud 体系中发挥了重要的作用。 一、FeignClient注解 FeignClient注解被@Target(ElementType.TYPE)修饰,表示FeignClient注解的作用目标在接口上 ...
分类:
其他好文 时间:
2021-02-03 10:31:00
阅读次数:
0
@RestController注解,相当于@Controller+@ResponseBody两个注解的结合,返回json数据不需要在方法前面加@ResponseBody注解了,但使用@RestController这个注解,就不能返回jsp,html页面,视图解析器无法解析jsp,html页面 @Re ...
分类:
编程语言 时间:
2021-02-02 11:28:20
阅读次数:
0
<html> <head> <title>第一个网页</title> </head> <body> <h1>这是第一个网页<h1> <!-- html的注释:注释不会被浏览器渲染出来,一般给开发人员看的,用来对代码解释说明的 标签一般成对出现,但是存在一些自结束标签 包括<img><input><i ...
分类:
Web程序 时间:
2021-02-02 11:14:45
阅读次数:
0
如果要添加接口校验,需要 1,在接口方法中请求参数前面添加@Valid注解,不需要在接口的实现类上添加@Valid注解: addAnimal(@Valid Animal a) 2,在请求对象类的每个要校验的字段上添加@Valid注解: public class Animal{ @Valid @Not ...
分类:
编程语言 时间:
2021-02-01 12:57:24
阅读次数:
0