随笔分类 - Spring
摘要:使用到Spring提供的工具类UriComponentsBuilder 代码: String url = "http://www.baidu.com"; String str = null; UriComponentsBuilder builder = UriComponentsBuilder.fr
阅读全文
摘要:概述 以下内容皆出自网上那几篇转来转去的文章,原作者不详,稍微的添加和删除了部分内容。 在Spring Boot中使用logback 第一步:添加依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>sprin
阅读全文
摘要:StopWatch是Spring提供的一个工具类,可以方便的对同步单线程代码块计时,使用简单,写出的代码也比用System.currentTimeMillis()更加简洁。 参考资料:https://blog.csdn.net/gxs1688/article/details/87185030 Dem
阅读全文
摘要:ps:推荐使用Feign package com.example.demo; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; import com.
阅读全文
摘要:测试代码 MyConfigurationProperties 项目为SpringBoot项目,在Postman中调/showValue即可看到结果。本文中例子都是基于properties文件。 package com.example.configuration; import org.springf
阅读全文
摘要:在传统 war 包中,因为 tomcat 中保存的是解压后的文件,所以可以根据绝对路径的方式 获取绝对路径的方法是 this.getClass().getResource("/").getPath(); 读取文件 但是在 SpringBoot 项目中不行,由于文件在 jar 包中,直接读会抛出jav
阅读全文
摘要:demo中用的是反射,因为我觉得这样代码能简洁一些,而且这样也可以动态导出指定列到Excel。不过我看网上很多文章都是存入一个List中,不知道这两种数据量大时候哪种更何合适一点,主要是性能方面,或者大佬们有什么更好的方法也请赐教。 pom <dependency> <groupId>org.apa
阅读全文
