2019年7月26日
摘要: 比如 Jackson、FastJson、Gson。其中,Jackson效率最高,最常用。 这里以 Jackson 为例。 Jackson处理相关字段 指定字段不返回,比如密码:@JsonIgnore 指定日期格式:@JsonFormat(pattern="yyyy-MM-dd hh:mm:ss",l 阅读全文
posted @ 2019-07-26 16:34 wuyicode 阅读(1368) 评论(0) 推荐(0) 编辑
摘要: SpringbootTest 基于Junit 的Test 当然也可以使用 @Before 和 @After , 和 junit 的测试一样。 启动类是必须要有的。 当有多个 @Test 的方法,需要一起执行的时候, 执行 XdclassSpringbootApplicationTests 这个类的 阅读全文
posted @ 2019-07-26 16:07 wuyicode 阅读(2328) 评论(0) 推荐(0) 编辑
摘要: 目的是避免硬编码。 使用场合一: controller 读取配置文件(@Value) 准备配置文件 准备配置文件 以 application.properties 为例。 在controller类加注解 在controller类加注解 @PropertySource("classpath:appli 阅读全文
posted @ 2019-07-26 13:58 wuyicode 阅读(2883) 评论(0) 推荐(0) 编辑