SpringBoot注解使用
黑鱼Heyu
这个作者很懒,什么都没留下…
展开
-
@ExceptionHandler使用理解
@ExceptionHandler(HttpRequestMethodNotSupportedException.class) public R httpRequestMethodNotSupportedException(Exception e) { logger.error(e.getMessage(), e); return R.error(405, "请求方式不支持!"); }此时的参数是HttpRequestMethodNotSupportedException.class.原创 2021-12-01 09:30:51 · 382 阅读 · 0 评论 -
SpringBoot返回一个页面(前后端不分离)
在controller页面上不能使用@RestController只能用!@Controller原创 2021-11-30 16:38:26 · 723 阅读 · 0 评论 -
Spring Boot返回Json数据及数据封装
在项目开发中,接口与接口之间,前后端之间数据的传输都使用 Json 格式,在 Spring Boot 中,接口 返回 Json 格式的数据很简单,在 Controller 中使用 @RestController 注解即可返回 Json 格式的数据.@ResponseBody 注解是将返回 的数据结构转换为 Json 格式。所以在默认情况下,使用了 @RestController 注解即可将返回的数据 结构转换成 Json 格式....原创 2021-11-30 16:37:11 · 451 阅读 · 0 评论 -
springboot 规定某些字段不展示
@JsonIgnoreProperties(value = {"字段1","字段2",...})原创 2021-11-24 09:18:57 · 1217 阅读 · 0 评论 -
@Qualifier注解
@Qualifier注解的用处:当一个接口有多个实现的时候,为了指名具体调用哪个类的实现。原创 2021-11-10 09:55:15 · 61 阅读 · 0 评论