
Java
文章平均质量分 59
SoulMapper
这个作者很懒,什么都没留下…
展开
-
Spring Bean解决循环依赖
Spring Bean的生命周期,以及如果解决循环依赖的问题;当循环依赖需要创建代理的时候,如果解决循环依赖的原创 2022-04-19 18:44:19 · 452 阅读 · 0 评论 -
checkstyle命令
checkstyle命令参数原创 2022-01-06 18:38:54 · 627 阅读 · 0 评论 -
application/x-www-form-urlencoded 中文参数乱码
application/x-www-form-urlencoded 中文参数乱码原创 2021-12-07 15:55:52 · 3616 阅读 · 0 评论 -
批量删除redis指定KEY
将要删除的KEY写入文件param.txt,每个KEY一行,例如param.txt:session:900231451session:872391734session:912783927session:527238729session:527349203按行读取KEY,注意cat读取后面有换行符,需要通过命令去掉:tr -d '\r'cat ./param.txt |tr -d '\r' | xargs -i redis-cli -h 127.0.0.1 -p 6379-a.原创 2021-11-22 12:08:22 · 710 阅读 · 0 评论 -
Springboot动态屏蔽组件/jar包
现象:SpringBoot服务屏蔽某些包目录com.compony.win:@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.CUSTOM, classes = CustomFilter.class))package com.company.win@Configurationpublic class MyConfig { @Bean public Person init()原创 2021-08-19 19:05:36 · 1216 阅读 · 0 评论 -
Connection marked as broken because of SQLSTATE(08S01), ErrorCode(0);Communications link failure
Question:springboot 2.X多数据源配置,一段时间后连接无效,不能进行有效性验证,提示:Connection marked as broken because of SQLSTATE(08S01), ErrorCode(0);Communications link failure开始以为是HikariCP连接池配置的有问题,后面发现是程序的问题,使用EntityManager查询操作,debug hikari也发现查询后连接无法释放Solution:使用@Persi原创 2020-08-04 11:24:11 · 15687 阅读 · 3 评论 -
JGIT AddCommand add无效,jgit add()方法调用
Windows下使用JGIT操作git,但是使用下面的API始终无法添加文件到index,仔细查看JGIT API才发现端倪Git.open(gitHome).add().addFilepattern(filePattern).call();filePattern使用相对路径 filePattern使用"/"作为分隔符附:1.JGIT API:http://mirror.neu.edu.cn/eclipse/jgit/docs/latest/apidocs.old/org/eclip.原创 2020-07-29 17:53:59 · 875 阅读 · 0 评论 -
datax 无法链接mysql:MySQLNonTransientConnectionException
问题:链接mysql的url, userName, password明明都正确,却一直报错:ERROR RetryUtil - Exception when calling callable, 异常Msg:Code:[DBUtilErrorCode-10], Description:[连接数据库失败. 请检查您的 账号、密码、数据库名称、IP、Port或者向 DBA 寻求帮助(注意网络环...原创 2020-01-19 11:41:54 · 3160 阅读 · 0 评论 -
restTemplate 下载文件处理
resTemplate.getForEntity()获取文件并下载,如何根据响应的结果判断返回类型?response.getHeaders.getContentType()都是"application/octet-stream"1. 正常情况返回二进制流文件,下载并保存2. 异常情况返回json文本,提示给前端显示附:postman下载文件 a. 错误的情况返回js...原创 2020-01-10 11:02:25 · 2798 阅读 · 0 评论 -
gRPC转http
1. grpc-gateway,grpc-gateway是protoc的一个插件2.Envoy, http过滤器,将RESTful JSON API转换成gRPC请求并发送给gRPC服务器原创 2019-08-14 17:53:25 · 1320 阅读 · 0 评论 -
MongoDB Multikey Indexes文档内嵌文档的索引
background:MongoDB collection count :3600004条例如:{ "_id" : ObjectId("5d3a7c75ffab2c23488e6974"), "name" : "myxk", "phone" : NumberLong(465200810), "age" : 55, "desc" : "chfu...原创 2019-07-26 15:07:59 · 1077 阅读 · 0 评论 -
java连接Access数据库"未发现数据源名称并且未指定默认驱动程序"
java7 连接access数据库出现java.sql.SQLException,无法找到ODBC驱动程序,需要注意数据库连接使用的URL:32位系统:url= "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=D://xg.mdb"64位系统:url = "jdbc:odbc:driver={Microsoft Access ...原创 2019-07-26 14:58:27 · 950 阅读 · 0 评论 -
@OneToMany级联删除
使用OneToMany做联级删除的时候发现无法删除,提示Error Code: 1048, SQL State: 23000 Column 'table_id' cannot be null,debug发现hibernate会执行update 子表 set table_id = null where id=?,并且没有执行删除语句;通过查询总结两种解决方法:1. 上文中无法联级删除是通过del...原创 2019-07-01 15:53:01 · 2799 阅读 · 2 评论 -
Java Collections reverse()源码解析
首先看源码,摘自于jdk 1.8.0_181: /** * Reverses the order of the elements in the specified list.<p> * * This method runs in linear time. * * @param list the list whose el...原创 2018-11-01 17:51:33 · 1723 阅读 · 0 评论 -
jetty部署WEB程序上下文启动两次,定时任务启动两次
将web程序部署到webapps目录下,导致定时任务启动两次,后来查看上下文启动,发现真的启动了两次,contextpath如下:1. /2. mycms我到webapps目录结构如下:mycms/website.xml其中website.xml文件是jetty的xml部署描述符,因此jetty启动后会启动两次,一次是website.xml部署文件启动的,另一次是jetty...原创 2018-09-27 22:22:19 · 710 阅读 · 0 评论 -
web.xml配置错误导致Spring Bean初始化两次,NoUniqueBeanDefinitionException异常
先看我的web.xml配置如下(片段):<context-param><param-name>contextConfigLocation</param-name><param-value>classpath*:/applicationContext.xml,classpath*:/config/**/spring-*.xml,classp...原创 2018-09-20 17:35:27 · 932 阅读 · 0 评论 -
springboot 加载自定义yml文件
1. ConfigurationProperties注解的locations属性在1.5.X以后没有了,不能指定locations来加载yml文件2. PropertySource注解不支持yml文件加载,详细见官方文档:https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-feature...原创 2018-02-03 17:25:59 · 46224 阅读 · 8 评论 -
Ubuntu-Java-SerialPort-RXTX
Java使用开源Rxtx实现串口通讯 串口开发原创 2017-12-19 19:54:34 · 877 阅读 · 0 评论