随笔分类 - java
摘要:hutool工具类:需要导入hutool的依赖 工具类:DateUtil String datestr ="2021-12-01 22:25:30"; Date date =DateUtil.parse(datestr); //一天的开始,结果:2021-12-01 00:00:00 Date be
阅读全文
摘要:`引入pom`xml <dependency> <groupId>org.itstack.middleware</groupId> <artifactId>schedule-spring-boot-starter</artifactId> <version>1.0.0-RELEASE</versio
阅读全文
摘要:package com.lrhealth.mappingintegration.utils;import lombok.extern.slf4j.Slf4j;import org.springframework.beans.BeanUtils;import java.util.List;import
阅读全文
摘要:我们有时候在开发中需要向表中插入自增ID,这个时候领域模型如果想要获取该ID的值,就需要在相应的mapper文件中添加useGeneratedKeys="true" keyProperty="id"。 mapper.xml示例: <insert id="create" parameterType="
阅读全文
摘要:如果使用的是 Spring 或 Spring Boot 框架,可以直接使用 Spring Framework 自带的定时任务,使用上面两种定时任务的实现方式,很难实现设定了具体时间的定时任务,比如当我们需要每周五来执行某项任务时,但如果使用 Spring Task 就可轻松的实现此需求。 以 Spr
阅读全文
摘要:本地连接远程服务器debug端口 打开Intellij IDEA,在顶部靠右的地方选择”Edit Configurations…”,进去之后点击+号,选择”Remote”,按照下图的只是填写红框内的内容,其中Name填写名称,这里为remote webserver,host为远程代码运行的机器的ip
阅读全文
摘要:1 @Configuration 2 public class ScheduledTaskConfiguration implements SchedulingConfigurer { 3 4 /** 5 6 * instances to be registered against the give
阅读全文
摘要:1.首先导入依赖 <dependency> <groupId>com.github.ulisesbocchio</groupId> <artifactId>jasypt-spring-boot-starter</artifactId> <version>2.1.0</version> </depen
阅读全文
摘要:String sql = "INSERT INTO TABLEName(id int)"; StringBuilder stringBuilder = new StringBuilder(sql); // int index = stringBuilder.indexOf("TABLEName");
阅读全文
摘要:Project Object Model,项目对象模型。通过xml可扩展标记语言(EXtensible Markup Language)格式保存的pom.xml文件。作用类似ant的build.xml文件,功能更强大。该文件用于管理:源代码、配置文件、开发者的信息和角色、问题追踪系统、组织信息、项目
阅读全文
摘要:springboot 2.X多数据源配置时: Connection marked as broken because of SQLSTATE(08S01), ErrorCode(0); Communications link failure 发现连接池配置问题,于是添加设置 spring.datas
阅读全文
摘要:添加依赖 <!--sftp文件上传--> <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch</artifactId> <version>0.1.54</version> </dependency> 开始写工具类,直接拿去用: im
阅读全文
摘要:新建工具类: package com.lrhealth.mappingintegration.utils; import com.jcraft.jsch.Channel; import com.jcraft.jsch.ChannelExec; import com.jcraft.jsch.Chann
阅读全文
摘要:我需要执行的linux命令是: hdfs dfs -put [本地目录] [hadoop目录] 把jar包复制到hdfs某个文件夹下, 导入的jar包, import com.jcraft.jsch.ChannelExec; 新建空对象: ChannelExec openChannel =null;
阅读全文
摘要:正常使用@value注解去获取yaml或者properties中的文件是可以的,但是我在工具类中使用时,没有获取到配置文件里的值; 上网看了一下,有的说配置文件首行要空出来,试了一下无效; 先贴代码:这是一个本地文件上传到服务器的工具类 import com.jcraft.jsch.Channel;
阅读全文
摘要://{a=1, b=2, c=3} 格式转换成map private static Map<String, String> mapStringToMap(String str) { str = str.substring(1, str.length() - 1); String[] strs = s
阅读全文
摘要:Date date=null; 把date给值就是空.
阅读全文
摘要:https://blog.csdn.net/weixin_45156610/article/details/105433804 cellStyle.setAlignment(HorizontalAlignment.CENTER); cellStyle.setVerticalAlignment(Ver
阅读全文
摘要:修改启动类文件,重配置一下tomcat@Configuration public class TomcatConfig { @Value("${server.http.port}") private int httpPort; @Bean public ServletWebServerFactory
阅读全文
摘要:String date = "Thu Aug 27 18:05:49 CST 2015"; SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); Date d = sdf.par
阅读全文