spring提供的SQL工具类执行SQL脚本
发表于|更新于
|浏览量:
方向是比速度更重要的追求。——白岩松
这里主要是用到了org.springframework.jdbc.datasource.init.ScriptUtils#executeSqlScript(java.sql.Connection, org.springframework.core.io.Resource)方法
例如
1 | @BeforeAll |
这样的话就可以使用resources目录下的init.sql
相关推荐
2023-03-15
关联表更新封装
凭自己的本事和正当手段挣来的钱财,可以使我们赢得道义和幸福——阿基兰 分享一个关联更新函数 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174package com.ruben.simplestreamquery...
2022-09-14
java标签
重要的不是知识的数量,而是知识的质量。有些人知道的很多很多,但却不知道最有用的东西——列夫·托尔斯泰 多层for循环中如果想要跳出循环,可以使用标签: 12345678910111213List<Integer> list = asList(0, 1, 2);Assertions.assertNotNull(list);outerOfList:for (Integer integer : list) { for (Integer i : list) { System.out.println(i); // 直接跳出最外层循环 break outerOfList; } // 不会执行 System.out.println(integer);} 执行结果
2023-05-08
为streampark新增用户资源转移功能
凡事一俭,则谋生易足;谋生易足,则求人无争,亦于人无求。——钱泳 相关的pr:https://github.com/apache/incubator-streampark/pull/2734 对应的描述: What changes were proposed in this pull requestIssue Number: close #2712 Brief change log Requirement: The administrator cancels the user deletion function and replaces it with disabling users. Detailed logic: The administrator cancels the user deletion function. When the user account is disabled, it cannot own resources (application and project ownership) Add resource transfer func...
2020-11-18
使用stream流连接两个list
生命如同寓言,其价值不在于长短,而在于内容—— 塞涅卡 1234567List<Integer> integerList = Arrays.stream(new int[]{1, 2, 3}).boxed().collect(Collectors.toList());List<Integer> collect = Stream.concat(integerList.stream(), integerList.stream()).collect(Collectors.toList());collect.forEach(System.out::print);System.out.println();collect = Stream.of(integerList, integerList).flatMap(List::stream).collect(Collectors.toList());collect.forEach(System.out::print);System.out.println();
2023-05-16
使用arthas+mat排查故障
情操要高尚!成为我们真正荣誉的,是我们自己的心,而不是他人的议论。——席勒 今天发现线上CPU又百分百了。。。 于是开始使用arthas排查 12curl -O https://arthas.aliyun.com/arthas-boot.jarjava -jar arthas-boot.jar 然后选择对应的web项目 首先我执行了dashboard命令 发现heap为百分之九十几的占用,那我直接执行 1heapdump --live /tmp/dump.hprof 然后下载到本地,再下载一个MAT(Memory Analyzer Tool)进行分析 下载地址:https://www.eclipse.org/mat/downloads.php 我们解压,打开(需要配置java17环境变量)后点击Open Heap Dump 然后选择我们的hprof文件 然后报错 点击Details >>才发现原来是内存不足,我们设置下内存大小 打开MemoryAnalyzer.ini,修改-Xmx1024m为合适的大小 这里点击Histogram查看对象占用 发现f...
2020-12-23
@ModelAttribute
小人之过也必文。——《论语》 如果我们需要在controller执行前做一些事情,除了使用AOP外,我们还可以使用@ModelAttribute注解 被@ModelAttribute注解的方法会在controller执行前执行并把结果传递给了下面controller里我们注解的参数 实际开发中可以用来鉴权、过滤参数等 12345678910111213141516171819202122232425262728293031package com.ruben.controller;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.ModelAttribute;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;/** * @...

阿超
我的名字叫阿超 年龄25岁 家在北京市 职业是软件开发 每天最晚也会在八点前回家 不抽烟 酒浅尝辄止 晚上十二点上床 保证睡足八个小时 睡前写一篇博客 再做二十分钟俯卧撑暖身 然后再睡觉 基本能熟睡到天亮 像婴儿一样不留下任何疲劳和压力 就这样迎来第二天的早晨 健康检查结果也显示我很正常 我想说明我是一个不论何时都追求内心平稳的人 不拘泥于胜负 不纠结于烦恼 不树立使我夜不能寐的敌人 这就是我在这社会的生活态度
Follow Me公告
This is my Blog