1 package com.yhqtv.demo01Exception; 2 3 import java.io.File; 4 import java.io.FileInputStream; 5 import java.io.FileNotFoundException; 6 import java. ...
分类:
其他好文 时间:
2020-04-26 10:50:32
阅读次数:
49
在实现简单的接口限流或者商品秒杀时,一般需要Redis来作为计数器。但是在并发场景下,使用不当的可能会踩坑。 这里主要的坑就是:使用不当,会造成key永久有效,永不过期,导致value一直在increment,无法起到限流的作用。 下面就以反面例子说明: 本文使用的是spring-data-redi ...
分类:
其他好文 时间:
2020-04-25 23:41:50
阅读次数:
99
Java使用poi对Execl简单写操作 public class WriteExecl { public void writeExeclTest() throws Exception{ OutputStream os = new FileOutputStream("F:/execl/writeTe ...
分类:
编程语言 时间:
2020-04-25 17:20:28
阅读次数:
77
一、通过一个对象获得完整的包名和类名 package net.xsoftlab.baike; public class TestReflect { public static void main(String[] args) throws Exception { TestReflect testRe ...
分类:
编程语言 时间:
2020-04-25 00:56:13
阅读次数:
85
Java项目的安全框架一般使用 shiro 与 spring security 具体怎么选择可以参考文章:安全框架 Shiro 和 Spring Security 如何选择 我这里选择使用Shiro 环境搭建 创建SpringBoot项目 导入Maven依赖 <dependency> <groupI ...
分类:
编程语言 时间:
2020-04-23 19:13:17
阅读次数:
66
public String doEdit( BrandVO brandVO,@RequestParam(value="pic")MultipartFile file) throws IllegalStateException, IOException{ //CurrentUser user = Cu ...
分类:
Web程序 时间:
2020-04-22 16:27:38
阅读次数:
108
Thread public static void sleep(long millis, int nanos) throws InterruptedException { if (millis < 0) { throw new IllegalArgumentException("timeout va ...
1、(终极解释!!!)throws Exception放在方法后边,是throws Exception表示的是本方法不处理异常,交给被调用处处理(如果你不希望异常层层往上抛,你就要用throws Exception) ,而且被调用处必须处理。 2、throw new Exception 表示人为的抛 ...
分类:
编程语言 时间:
2020-04-20 18:56:01
阅读次数:
81
转自:https://www.cnblogs.com/chenzhanxun/articles/4463151.html 今天刚学了网络编程在网上尝试下载东西时报: sun.security.validator.ValidatorException: PKIX path building faile ...
分类:
编程语言 时间:
2020-04-19 18:13:48
阅读次数:
143
1.JDBC概念 全称:java database connectivity ,JDBC 规范定义接口,具体的实现由各大数据库厂商来实现。 JDBC 是 Java 访问数据库的标准规范,真正怎么操作数据库还需要具体的实现类,也就是数据库驱动。每个 数据库厂商根据自家数据库的通信格式编写好自己数据库的... ...
分类:
数据库 时间:
2020-04-19 14:44:27
阅读次数:
69