自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(35)
  • 收藏
  • 关注

原创 jackson反序列化 过滤特殊字符 控制字符

jacskon默认是可以序列化一些特殊字符但反序列化时就不支持了Exception in thread "main" com.fasterxml.jackson.core.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 31)): has to be escaped using backslash to be included in string value at [Source: (String)"{ "

2021-01-22 10:26:31 4689

原创 SpringBoot Mybatis 分库分表 sharding

史上最简洁的分库分表中间件 基于Spring+Mybatis的分库分表基于Mapper的切面 数据源默认使用HikariDataSource@Componentpublic class ShardingStrategyImpl implements ShardingStrategy { private Long shardingKey = 15L; @Override public Long getShardingKey() { // 例子:.

2020-06-30 20:29:23 748

原创 Mybatis on duplicate key update 不返回主键

<insert id="insertOrUpdate" parameterType="XXXX" useGeneratedKeys="true" keyProperty="id"> <include refid="insertSql"/> on duplicate key update <trim suffixOverrides=","> <include refid="updateSql"/> </trim> &l.

2020-06-02 10:07:15 4048 1

原创 Spring @Cacheable指定失效时间

@Component public class RedisCacheCustomizer implements CacheManagerCustomizer<RedisCacheManager> { /** CacheManager缓存自定义初始化比较早,尽量不要@autowired 其他spring 组件 */ @Over...

2020-03-21 18:04:31 10087

原创 mysql for update悲观锁能否锁住一条不存在的记录

行锁的3种算法锁是针对索引加锁,如果查询条件无索引,全表扫描、全表锁。不讨论!1.Record LOCK 单行记录上的锁2.Gap LOCK 间隙锁,锁定一个范围,但不包含记录本身3.Next-KEY Lock:Gap LOCK+Record Lock,锁定一个范围,并且锁定记录本身Innodb对于行的查询都是采用Next-KEY Lock,但是当查询索引时含有唯一...

2019-07-22 14:28:02 6032 3

转载 both methods have same erasure, yet neither overrides the other

这段代码会报一个编译错误,both methods have same erasure, yet neither overrides the other。这个错误的意思是,两个方法在类型擦除后,具有相同的原生类型参数列表,但是也不能覆盖另一个方法。泛型类型在编译后,会做类型擦除,只剩下原生类型。如参数列表中的T类型会编译成Object,但是会有一个Signature。尽管两个getVa...

2019-07-18 17:01:21 8550

原创 spring工具类大全

spring工具类大全AnnotatedElementUtilsAnnotationBeanUtilsAnnotationConfigContextLoaderUtilsAnnotationConfigUtilsAnnotationUtilsAopConfigUtilsAopNamespaceUtilsAopProxyUtilsAopUtilsAspectJAopUt...

2019-07-02 08:22:13 304

原创 idea springboot多module 找不到配置文件问题 eclipse正常

2019-06-25 18:21:29 2397 2

原创 nginx反向代理websocket wss failed: Error during WebSocket handshake: Unexpected response code: 403

failed: Error during WebSocket handshake: Unexpected response code: 403在nginx配置proxy_set_header Origin '';server { ... location /chat/ { proxy_pass http://backend; ...

2019-06-24 12:25:43 5679

原创 spring aop获取代理目标对象

TransitionDataStrategy strategy = context.getBean(beanName, TransitionDataStrategy.class); if (AopUtils.isAopProxy(strategy)) { strategy = (TransitionDataStrategy) AopProx...

2019-05-24 17:23:12 1969

原创 Tcc框架

tcc-transaction https://github.com/changmingxie/tcc-transaction Hmily https://github.com/yu199195/hmily ByteTCC https://github.com/liuyangming/ByteTCC EasyTransaction https:/...

2019-05-10 16:38:25 1525

原创 springboot中logback自动发送error日志告警到钉钉

1、自定义appender,先在logback.xml中配置 <appender name="SendErrorMsgAppender" class="com.xxx.xxx.xxx.common.SendErrorMsgAppender"></appender>2、配置Appender引用,这步不能少,少了Appender不启作用...

2019-04-23 12:28:05 4624

原创 Mysql DeadLock 死锁

表结构CREATE TABLE `t_custom_sku_price` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键', `customSkuId` BIGINT(20) DEFAULT NULL COMMENT '自定义skuid', `priceType` INT(11) DEFAULT NULL COMMENT...

2019-03-06 12:55:05 194

原创 Elasticsearch问题集

1、org.springframework.data.elasticsearch.ElasticsearchException: Bulk indexing has failures. Use ElasticsearchException.getFailedDocuments() for detailed messages [{lveWSGgBmHj4rHXPCc0q=ClusterBlockEx...

2019-01-15 16:39:45 5020

原创 maven scope

1、test范围指的是测试范围有效,在编译和打包时都不会使用这个依赖2、compile范围指的是编译范围有效,在编译和打包时都会将依赖存储进去3、provided依赖:在编译和测试的过程有效,最后生成war包时不会加入,诸如:servlet-api,因为servlet-api,tomcat等web服务器已经存在了,如果再打包会冲突 4、runtime在运行的时候依赖,在编译的时候不依赖...

2018-12-05 09:06:07 95

转载 MySQL 加锁处理分析

MySQL 加锁处理分析发表于 2013 年 12 月 13 日 由 hedengcheng转自:http://hedengcheng.com/?p=771 1    背景    11.1    MVCC:Snapshot Read vs Current Read    21.2    Cluster Index:聚簇索引    31.3    2PL:Two-Phas...

2018-11-22 15:50:50 96

转载 ElasticSearch: Index 和 Type 的区别

转:http://bayescafe.com/database/elasticsearch-using-index-or-type.html对于 ES 的新用户来说,有一个常见的问题:要存储一批新的数据时,应该在已有 index 里新建一个 type,还是给它新建一个 index?要想回答这个问题,我们必须先理解这两者是怎么实现的。过去,我们为了让 ES 更容易理解,经常用关系型数据库做一...

2018-11-22 15:40:53 274 1

原创 MySQL锁

in 语句怎么锁1、id是主键,加锁,看mysql是先锁住9还是2或是9,2,1一起锁住,有些文章说,mysql会自动排序,现锁住1;2和9不被锁住2、打开另一个窗口,锁等待看来Mysql没有排序3、看1和2是否被锁住,锁等待结论:mysql in的时候全部加锁。死锁列子锁等待避免死锁1、避免死锁的方法1、如果不同程序并发存取...

2018-11-17 15:12:38 117

原创 list分组

// 通过spuid分组        ListMultimap&lt;Long, CommonSku&gt; groupMap = Multimaps.index(commonSkus, (commonSku) -&gt; {            return commonSku.getSpuId();        });

2018-11-16 14:21:39 153

原创 eureka服务注册与发现

1、服务器发现的方式1.1 客户端发现     客户端查询服务注册表,使用负载均衡算法选择一个实例,并发送请求。代表Zk、Eureka1.2 服务器端发现     服务器端自己维护一个服务注册表,将request转发到指定的服务。...

2018-06-28 16:00:49 828

原创 如果打成jar包,读取classes下的文件怎么写

一般读取classes下的资源文件getClass().getResource("//").getPath()+"xxx.xml";如果打成jar包就不行了。通用方式如下InputStream is = getClass().getResourceAsStream("/xxx.xml")

2016-11-18 21:21:27 1789

转载 log4j2详解

1、配置文件说明1.1、log4j2默认会在classpath目录下寻找log4j.json、log4j.jsn、log4j2.xml等名称的文件,如果都没有找到,则会按默认配置输出,也就是输出到控制台。下面我们按默认配置添加一个log4j2.xml,添加到src根目录即可status="WARN">

2016-11-16 15:26:03 5662

原创 replaceAll(String regex, String replacement)

replaceAll(String regex,String replacement) 第一个参数是正则表达式。看下面代码template = template.replaceAll("[", "").replaceAll("]", ""); \\报错template = template.replaceAll("\\[", "").replaceAll("\\

2016-11-15 11:25:06 1731

原创 spring boot servlet filter linstener

在spring boot中可以直接申明的servlet,fiter或者listener,只要将其申明为bean后spring boot自然识别, 因此在spring boot中申明filter有两种方式(servlet,listener)一样方式一:@Componentpublic MyFilter implements Filter{...}方式二

2016-10-29 00:26:59 442

原创 maven项目 关于Eclipse报:" cannot be read or is not a valid ZIP file"的解决方案

这中情况 说明依赖的jar包没有完全下好。到repository 中删去相应的jar目录 让maven重新去下载。如果还报错1、删除maven报错,eclipse中打开pom.xml 编辑状态 重新保存。看看最新的报错信息,进入对应的目录,删除即可2、如果是eclipse,检查jdk版本,不要使用eclipse自带的jre环境,请使用jdk完整版本...

2016-10-28 08:46:44 21450 2

原创 spring aop 同一个bean中方法调用方法

@ComponentpublicclassTestBean{publicvoida(){this.b();} @Transactionalpublicvoidb(){System.out.println("methodBexecuting...");}}...

2016-08-30 17:25:42 2650

转载 RPM安装与卸载MySQL-5.6.27-1.linux*.x86_64.rpm*

http://blog.csdn.net/liu_yulong/article/details/50328447

2016-08-11 17:39:26 285

原创 Slow query log日志跟踪

优化MySQL最重要的一部分工作是先确定”有问题”的查询语句。只有先找出这些查询较慢的sql查询(执行时间较长),我们才能进一步分析原因并且优化它。MySQL为我们提供了Slow Query Log记录功能,它能记录执行时间超过了特定时长的查询。分析Slow Query Log有助于帮我们找到”问题”查询。记录slow queries首先,我们需要查看mysql server版本号,以

2016-06-29 08:56:59 423

转载 mysql单表百万记录,limit分页

对limit分页问题的性能优化方法利用表的覆盖索引来加速分页查询我们都知道,利用了索引查询的语句中如果只包含了那个索引列(覆盖索引),那么这种情况会查询很快。因为利用索引查找有优化算法,且数据就在查询索引上面,不用再去找相关的数据地址了,这样节省了很多时间。另外Mysql中也有相关的索引缓存,在并发高的时候利用缓存就效果更好了。在我们的例子中,我们知道id字段是主键

2016-06-28 15:07:44 658

原创 suse下安装apache

环境:SUSE 11 SP1软件包:httpd-2.2.25.tar.gz、tomcat-connectors-1.2.31-src.tar.gz 步骤1.创建apache2目录2.将以上2个tar.gz包上传至apache2目录,解压[html] view plaincopycd apache2  tar

2014-06-11 19:42:34 904

原创 MySQL重置 Auto_increment字段起始值

有2种方法:1.alter table tbname auto_increment = x  ;设置表tbname的唯一auto_increment字段起始值从x开始,如果此表数据量很多的话,这样执行起来会很慢。2.truncate tbname ;直接清空所有数据,下次插入数据时auto_increment字段会自动从0开始。 和delete from tbname不同的是d

2014-05-24 10:34:35 433

原创 MySQL远程访问权限,允许远程连接的开启

MySQL远程访问权限,允许远程连接的开启 1、登陆mysql数据库       mysql -u root -p   查看user表  www.2cto.com  mysql> use mysql;Database changedmysql> select host,user,password from user;+--------------+------+--

2014-05-21 22:08:26 337

原创 mysql 启动错误-server PID file could not be found

root@centos var]# service mysqld stopMySQL manager or server PID file could not be found!       [FAILED]解决办法:首先查看一下进程[root@irxpert-test /]# ps aux |grep mysq*root     10274  0.0  0

2014-05-18 08:56:11 490

原创 wowslider去除官方链接

删除V.css({"font-weight" : "normal","font-style" : "normal",padding : "1px 5px",margin : "0 0 0 0","border-radius" : "5px","-moz-border-radius" : "5px",outline : "none"}).attr({href

2014-05-15 21:54:38 663

原创 解决easyui 1.3.4之后版本 页面加载后 validatebox默认校验

return this.each(function(){var _406=$.data(this,"validatebox");if(_406){$.extend(_406.options,_404);}else{init(this);$.data(this,"validatebox",{options:$.extend({},$.fn.validatebox.defaul

2014-04-27 16:52:25 605

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除