上一页 1 ··· 47 48 49 50 51 52 53 54 55 ··· 68 下一页
摘要: ⒈文件实体类 ⒉控制器代码 ⒊测试 阅读全文
posted @ 2019-03-27 21:32 SpringCore 阅读(2575) 评论(0) 推荐(0)
摘要: ⒈使用Filter(过滤器) 当然,如果是你自己写的Filter一般都会这样,别人的Filter就没有办法使用@Component注解了,那么你可以使用Web.xml,当然SpringBoot没有这个,可以使用SpringBoot独有的方式。 遗憾的是,Filter是Servlet提供的,Sprin 阅读全文
posted @ 2019-03-27 18:22 SpringCore 阅读(645) 评论(0) 推荐(0)
摘要: ⒈编写校验逻辑类 ⒉自定义校验注解并使用校验逻辑类 ⒊使用(略) 阅读全文
posted @ 2019-03-26 22:50 SpringCore 阅读(1312) 评论(0) 推荐(0)
摘要: 1 /** 2 * 添加用户,使用@RequestBody将请求体映射到Action方法参数中 3 * 使用@Valid注解验证请求参数的合法性 4 * 使用BindingResult处理校验结果 5 * @param user 6 * @param result 7 * @return 8 */ 9... 阅读全文
posted @ 2019-03-26 19:58 SpringCore 阅读(669) 评论(0) 推荐(0)
摘要: 建议使用时间戳来避免日期格式带来的前后端问题,使用时间戳可以避免前后端、平台等问题。 阅读全文
posted @ 2019-03-26 18:49 SpringCore 阅读(399) 评论(0) 推荐(0)
摘要: 1 @PostMapping("/user") 2 public User create(@RequestBody User user){ 3 System.out.println(user.toString()); 4 user.setId(5l); 5 return user; 6 } 1 @Test 2 ... 阅读全文
posted @ 2019-03-26 14:44 SpringCore 阅读(1045) 评论(0) 推荐(0)
摘要: 我也是刚看到原来还可以这么玩,但是我还是习惯使用Dto,我总感觉这样做的话实体类耦合程度有点高。还是记录以下,万一今后用到了呢 ⒈在实体类中使用接口来声明该实体类的多个视图。 ⒉在实体类的属性get方法上指定该属性在那个视图中呈现。 ⒊在控制器的Action方法上使用@JsonView注解声明该Ac 阅读全文
posted @ 2019-03-26 13:09 SpringCore 阅读(823) 评论(0) 推荐(0)
摘要: 1 @GetMapping("/user/{id:\\d+}") //使用正则指定Id为数字 2 public User getInfo(@PathVariable String id){ 3 ... 4 } 阅读全文
posted @ 2019-03-25 21:20 SpringCore 阅读(3130) 评论(0) 推荐(0)
摘要: 1 package cn.coreqi.security.controller; 2 3 import org.junit.Before; 4 import org.junit.Test; 5 import org.junit.runner.RunWith; 6 import org.springframework.beans.factory.annotation.Autowire... 阅读全文
posted @ 2019-03-25 20:17 SpringCore 阅读(656) 评论(0) 推荐(0)
摘要: ⒈实体Bean ⒉仓库 ⒊服务层 ⒋控制层(待补充 阅读全文
posted @ 2019-03-22 20:42 SpringCore 阅读(591) 评论(0) 推荐(0)
上一页 1 ··· 47 48 49 50 51 52 53 54 55 ··· 68 下一页