
后台
这样の我
这个作者很懒,什么都没留下…
展开
-
nginx 代理请求头与跨域
nginx 代理请求头与跨域原创 2022-08-30 16:16:53 · 3579 阅读 · 0 评论 -
nginx限流 漏桶与令牌桶
nginx限流,漏桶、令牌桶原创 2022-08-16 10:11:40 · 1208 阅读 · 0 评论 -
ibatis.reflection.ReflectionException: Could not set property ‘id‘ of
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'id' of 'class com.zzy.web_practice.entity.Practice1' with value '1520304645107871746' Cause: java.lang.IllegalArgumentE原创 2022-04-30 15:44:21 · 938 阅读 · 0 评论 -
【javax.xml.bind.PropertyException: name: com.sun.xml.internal.bind.marshaller.CharacterEscapeHandle】
xml解析找不到CharacterEscapeHandler原创 2022-04-24 17:55:11 · 1802 阅读 · 0 评论 -
java 实现aes-128-cbc(php)
1.php5.* 和php7.* 的 aes-128-cbc实现都是不一样的。2.php7.* 代码openssl_encrypt($str, 'aes-128-cbc', $secrete_key,OPENSSL_NO_PADDING, $iv);对应实现模式:AES/CBC/PKCS7Padding、AES/CBC/PKCS5Padding若使用AES/CBC/PKCS5Padding,可在jdk8直接运行,但是输出结果不一致,需使用其他provider Security.add原创 2022-04-13 10:37:41 · 1195 阅读 · 2 评论 -
java pmt以及ipmt计算
引用poi包里面的financing类方法包名org.apache.poi.ss.formula.functions方法Finance.pmt()方法Finance.ipmt()原创 2022-03-01 15:53:09 · 755 阅读 · 0 评论 -
content-md5加密 编码的坑
MD5 算法输出的结果为 128 位长的摘要。当以网络字节序(大端序) 解析时,可得到16字节的二进制数据序列。随后,将这 16 个字节按 base64 算法编码,最终得到可作为 Content-MD5 字段取值的结果。因此,针对 MIME 实体的原始数据应用 MD5 算法。MD5 作为校验码,是一个 128 位长的二进制数。 在内存中,128 bits = 16 octets。 经过 [Base64][4] 编码,长度增加约 33%,编码后的长度应为 4*⌈16/3⌉ = 24 字节。 而正常编码下的长原创 2022-01-27 12:47:03 · 2300 阅读 · 0 评论 -
bytebuffer读写数据,nio使用时读到上一次的数据
首先看一组代码 ByteBuffer writeBuffer = ByteBuffer.allocate(1024); writeBuffer.put(new String("大话西游").getBytes()); System.out.println(new String(writeBuffer.array())); writeBuffer.clear(); System.out.println(new String(writ原创 2021-01-29 15:11:14 · 716 阅读 · 0 评论 -
阿里云网关签名特殊字符无法通过
原代码public static String sendAlaDinByPost(String url, int soTimeout, int connectTimeout, String goodsSerial) { // logger.info("请求地址为:" + url); String bodyString = "{\"sku\":[\"" + goodsSerial + "\"]}"; String stringToSign = ""; String date = new D原创 2020-09-07 15:35:02 · 625 阅读 · 0 评论 -
spring加载拦截器找到多个bean
spring拦截器加载顺序本地逻辑创建拦截器-》加入配置在使用注入时spring会自动去找容器的bean,但在配置类是首先加载的,@component注解加载在spring扫描注解时才加入所以在拦截器上加@component注解,然后在配置类使用@autowire是很容易产生加载spring加载顺序的问题的,可能ide运行的时候没报错,打包过后运行就报错了。源代码/** * @description: 访问拦截器 * @author: zzy * @create : 2020-08_28原创 2020-08-29 09:29:54 · 399 阅读 · 0 评论 -
feign文件传输
pom文件添加依赖<dependency> <groupId>io.github.openfeign.form</groupId> <artifactId>feign-form</artifactId> <version>3.3.0</version> </dependency> <dependency> <groupId>io.github.openfe原创 2020-08-24 16:25:59 · 3121 阅读 · 2 评论 -
shiro与jwt在分布式系统的表现
shiro:需要验证一次密码,会自动记住此sessionid判断为当前用户,保存其principals使用token时principals为token在分布式环境下sessionid是没有用的,只能用token作为唯一标识,shiro必须使用AbstractSessionDAO 来改变判断用户在登录后认证会保存到缓存中,每次进来时会通过服务的缓存来判断是哪个用户登录,所以在分布式系统中必须调用集群中每一个服务的登录可通过拦截器判断是否用友token判断其是否已登录,未登录则调用shiro的登录re原创 2020-08-24 15:32:28 · 631 阅读 · 0 评论 -
zuul网关文件上传优雅解决方案
出处:spring-zuulzuul网关对于文件上传并不友好,ribbon,hystrix一堆乱七八糟的配置会导致文件(特别是大文件)上传超时我们只需要在路径前面加/zuul即可绕过这些配置原创 2020-07-10 11:09:30 · 867 阅读 · 0 评论 -
list.remove之 ConcurrentModificationException
list的遍历for(int i=0;i<list.size();i++){ if(lsit.get(i)==xxx){ list.remove(i); }}上面代码表面上没有问题,实际上当满足条件的 节点大于1时list的顺序以及大小已经改变,遍历时会跳过一个节点,此慎坑。for(Object o:list){ if(o.equals(xx)){ list.remove(o); }}若满足if条件,此处代码会报错。因为foreach底层使用iterator,迭代器在运原创 2020-06-19 15:22:16 · 281 阅读 · 1 评论 -
spring5.0适配velocity
公司老项目jar包升级,spring需升级到5.0,原来模板引擎为velocity,不好重新换模板引擎。百度加上自身试验适配velocity首先是pom<dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity-tools</artifactId> <version>2.0</version> <原创 2020-06-18 14:35:30 · 1375 阅读 · 0 评论 -
shiro拦截导致跨域,文件上传不成功
先上解决办法package com.mengruan.webbackage.config;import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;import org.springframework.context.annotation.Configuration;import javax.servlet.Se...原创 2020-04-26 17:24:54 · 1106 阅读 · 0 评论 -
maven springboot多模块打包
分模块开发公共模块不要使用springboot插件,其他引用其公共模块的报会读取不到包。打完公共模块的包记得发布到本地maven仓库 <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifa...原创 2020-01-17 18:25:49 · 377 阅读 · 0 评论 -
redistemplate 序列化配置
RedisTemplate一般配置 @Bean public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { RedisTemplate<Object, Object> redisTemplate = new ...原创 2020-01-13 16:23:37 · 1203 阅读 · 0 评论 -
老版本elasticsearch miss过滤
{ "query": { "filtered":{ "filter":{ "missing":{ "field":"id" } } } },"from":0,"size":3}```查询...原创 2019-12-11 17:24:44 · 176 阅读 · 0 评论 -
poi excel工具
导入excel返回List<List>pom <!--处理2003 excel&ndash--> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>...原创 2019-10-17 14:28:49 · 220 阅读 · 0 评论 -
mybatis insert返回主键
使用springboot整合shiro写demo的时候发现一个问题,当我在使用mybatis的insert标签时, <insert id="addUser" useGeneratedKeys="true" keyProperty="userid" >插入一点问题也没有,但是当我们拿到userid的时候永远是1,因为它返回的是插入成功的数量 Integer addUser(@...原创 2019-07-01 16:51:37 · 152 阅读 · 0 评论 -
springboot整合shiro之post提交不可用
整合部分我们直接跳过我们直接看问题There was an unexpected error (type=Method Not Allowed, status=405).这是在login的form表单post提交跳转后访问页面的情况,当我们使用get提交时没有问题。看看我们当时的webapp目录结构我发现success放在static下面只能使用get请求才能访问到,当时我并未使用模板...原创 2019-06-30 12:58:47 · 807 阅读 · 0 评论 -
Unresolved Maven dependencies
在使用maven搭建springcloud项目的时候发现老师在maven依赖里面报错Unresolved Maven dependencies “xxx.xxx.jar”。这是由于maven没有下载到对应的jar包,或者jar包下载错误了。本人分析可能原因有两种:1.jar包没有下载完,我们可以手动打开本地maven仓库找到对应的jar包,然后把jar包删除重新下载,下载完后把pom中的d...原创 2019-07-29 14:23:50 · 15285 阅读 · 0 评论 -
springboot shiro注解不起作用
shiro框架两个常用注解@RequiresRoles@RequiresPermissions这两个注解是用来控制是否用户有权限调用此方法的。没有起作用的原因可能有两种1.缺少配置spring.xml里面增加配置<!-- 1.配置lifecycleBeanPostProcessor,可以在Spring IOC容器中调用shiro的生命周期方法. --&g...原创 2019-07-17 21:55:40 · 1081 阅读 · 0 评论 -
hystrixboard一直loading
需要先调用feign的消费者端一次,也就是客户端(负载均衡)要调一次服务端参考地址https://cloud.tencent.com/developer/article/1333822转载 2019-08-02 17:16:20 · 605 阅读 · 0 评论 -
ribbon-eurek找不到服务(ribbon No instances available for xxx)
ribbon配置使用eureka服务非常简单,miain方法加一个@EnableDiscoveryClient在配置类的resttemplate方法上面加注解@LoadBalanced使用ribbon的时候报错 ribbon No instances available for xxx大意为在eureka里找不到该服务我在这里列出两种可能:该ribbon服务未在eureka里面注册,打...原创 2019-07-31 18:19:31 · 2125 阅读 · 0 评论 -
Thumbnails压缩图片到指定大小
网上看了很多demo,很多都是照搬别人的代码,不管有没有问题,有的甚至递归不关流,还有的递归疯狂往自己磁盘写文件,递归一次写一次,我自己把网上的demo整理改了下发出来。 /** * @Description: 压缩图片到指定大小 * @Param: desFileSize:大小,accuracy:每次缩小几倍 * @return: String * @A...原创 2019-09-30 14:04:30 · 3636 阅读 · 3 评论 -
springboot2.0+容联云短信
springboot2.0+容联云短信废话不多说,简单讲诉一下本人使用springboot2.0来配置容联云短信遇到的坑吧。1.在eclipse中试验demo,里面有jar包此jar包是五个jar包及容联云自己写的一堆代码所组成的新jar包。没错,就是这五个,首先,我在eclipse上面跑demo一点问题都没有,然后我将代码copy到idea,使用maven install 将jar...原创 2019-03-14 19:32:12 · 1329 阅读 · 4 评论