实用代码
明明吃了饭
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Java下载,预览pdf文件
@GetMapping("/previewPDF") public void download(HttpServletRequest request, HttpServletResponse response) throws IOException { String filePath = "G:\\JAVA\\xxx.pdf"; File f = new File(filePath); if (!f.exists()) { response.sendError(404, ".原创 2021-12-06 16:27:25 · 586 阅读 · 0 评论 -
Java集合深拷贝
/** * 描述:list集合深拷贝 参考 https://blog.youkuaiyun.com/u011019141/article/details/81182149 */ public static <T> List<T> deepCopy(List<T> src) { try { ByteArrayOutputStream byteout = new ByteArrayOutputStream(); ObjectOutputStream out = ne原创 2021-10-13 13:39:51 · 312 阅读 · 0 评论 -
springmvc读取txt文件
public List<String> convertStreamToString(MultipartFile file){ List<String> list = new ArrayList<>(); try (InputStream inputStream = file.getInputStream()) { BufferedReader reader = new BufferedReader(new InputStreamReader(原创 2021-05-29 13:28:28 · 757 阅读 · 0 评论 -
异步编排
带有Async方法 就是个 新开一条线程,否则就是和上面执行共用一条线程 runAsync @Test public void test01() throws ExecutionException, InterruptedException { // 没有返回结果 CompletableFuture<Void> async = CompletableFuture.runAsync(() -> { System.out.println("begin ===原创 2021-04-04 15:16:50 · 413 阅读 · 0 评论 -
Gateway配置
在Gateway中跨域配置 @Configuration public class GlobalCorsConfiguration { @Bean public CorsWebFilter corsWebFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = new CorsC.原创 2021-04-04 15:12:52 · 244 阅读 · 0 评论 -
【Java】多级菜单实现方式
多级菜单实现方式 gitee代码 Java组装 递归 按照Sort进行排序 public List<CategoryEntity> list() { //1、查出所有分类 List<CategoryEntity> entities = baseMapper.selectList(null); //2、组装成父子的树形结构 //2.1)、找到所有的一级分类 List<CategoryEntity> level1Menus = enti原创 2021-04-03 14:33:25 · 583 阅读 · 0 评论
分享