java工具类
大道至简@EveryDay
生活不止眼前的苟且,还有诗和远方的田野
展开
-
EasyExcel生成多个exel文件并zip压缩
easyexcel ,动态表头,自适应宽高,自适应居中,样式设置,zip压缩原创 2022-10-21 12:37:07 · 3427 阅读 · 1 评论 -
java发送 邮件工具类
pom 文件 <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-email</artifactId> <version>1.5</version> </dependency>1,工具类@Datapublic class原创 2021-08-25 16:30:24 · 716 阅读 · 0 评论 -
FileUtils
import org.apache.commons.codec.digest.DigestUtils;import org.apache.commons.lang3.StringUtils;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.web.multipart.MultipartFile;import javax.servlet.http.HttpServletResponse原创 2021-08-22 11:16:24 · 318 阅读 · 0 评论 -
HttpUtil
import java.io.IOException;import java.io.UnsupportedEncodingException;import java.util.ArrayList;import java.util.List;import java.util.Map;import org.apache.http.HttpEntity;import org.apache.http.client.ClientProtocolException;import org.apache.h原创 2021-08-22 11:15:31 · 2139 阅读 · 0 评论 -
JwtUtil工具类
import io.jsonwebtoken.Claims;import io.jsonwebtoken.JwtBuilder;import io.jsonwebtoken.Jwts;import io.jsonwebtoken.SignatureAlgorithm;import org.springframework.data.redis.core.RedisTemplate;import org.springframework.stereotype.Component;import jav原创 2021-08-22 11:02:25 · 3671 阅读 · 0 评论 -
Des3Utils工具类
import org.apache.commons.codec.binary.Base64;import javax.crypto.Cipher;import javax.crypto.SecretKey;import javax.crypto.SecretKeyFactory;import javax.crypto.spec.DESedeKeySpec;import java.nio.charset.StandardCharsets;public class Des3Utils {原创 2021-08-22 10:52:17 · 420 阅读 · 0 评论 -
Base64Utils
import org.apache.commons.codec.binary.Base64;import org.apache.commons.lang3.StringUtils;import java.nio.charset.StandardCharsets;public class Base64Utils { private Base64Utils() { } public static String encode(String text) { if原创 2021-08-22 10:51:21 · 324 阅读 · 0 评论 -
Base64Utils
import org.apache.commons.codec.binary.Base64;import org.apache.commons.lang3.StringUtils;import java.nio.charset.StandardCharsets;public class Base64Utils { private Base64Utils() { } public static String encode(String text) { if原创 2021-08-22 10:50:44 · 380 阅读 · 0 评论 -
签名工具类
import org.apache.commons.codec.binary.Hex;import org.apache.commons.lang3.ObjectUtils;import javax.crypto.Mac;import javax.crypto.spec.SecretKeySpec;import java.security.InvalidKeyException;import java.security.NoSuchAlgorithmException;public cla原创 2021-08-22 10:47:52 · 181 阅读 · 0 评论 -
IP工具类
import lombok.extern.slf4j.Slf4j;import javax.servlet.http.HttpServletRequest;import java.util.StringTokenizer;import java.util.regex.Pattern;@Slf4jpublic class IpUtils { private static final String IP_REGEX = "(?:25[0-5]|2[0-4][0-9]|[01]?[0-9]原创 2021-08-22 10:43:45 · 100 阅读 · 0 评论 -
AesUtils
AesUtils工具类import org.apache.commons.codec.binary.Base64;import javax.crypto.Cipher;import javax.crypto.KeyGenerator;import javax.crypto.SecretKey;import javax.crypto.spec.SecretKeySpec;import java.nio.charset.StandardCharsets;import java.security.原创 2021-08-22 10:42:33 · 505 阅读 · 0 评论 -
Md5Utils
MD5工具类public class Md5Utils { private final static char[] DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; private static MessageDigest digest; private Md5Utils() { } public static S原创 2021-08-22 10:38:47 · 309 阅读 · 0 评论 -
Redis工具类
import org.springframework.beans.factory.annotation.Autowired;import org.springframework.data.redis.core.RedisTemplate;import org.springframework.stereotype.Component;import org.springframework.util.CollectionUtils;import java.util.List;import java..原创 2021-08-10 22:36:03 · 108 阅读 · 0 评论 -
Dozer对象映射工具类
pom引入 <!-- https://mvnrepository.com/artifact/net.sf.dozer/dozer --> <dependency> <groupId>net.sf.dozer</groupId> <artifactId>dozer</artifactId> <version>5.5.1</version> </dep原创 2021-08-10 22:30:42 · 226 阅读 · 0 评论 -
properties的k-v反射多对象
应用场景:应用程序启动中 通过命令行"-c xxx.conf"指定某一个文件,然后可以使用该方法解析该文件到不同的对象中public static void properties2Object(final Properties p, final Object object) { Method[] methods = object.getClass().getMethods(); for (Method method : methods) { St原创 2021-07-25 22:01:33 · 133 阅读 · 0 评论 -
beans实现的类装换工具
public class BeanUtils { private static final BeanCopier FAILBACK = new BeanCopier() { @Override public void copy(Object from, Object to, Converter converter) { throw new UnsupportedOperationException(); } };原创 2020-06-09 08:59:37 · 180 阅读 · 0 评论 -
Jwt工具类
Componentpublic class JwtUtil { /** * 签名用的密钥 */ private static final String SIGNING_KEY = "fgsadfjkgsdakjfgsd642318263184"; @Resource RedisTemplate<String, Object> redisTemplate; /** * 用户登录成功后生成Jwt * 使用Hs25原创 2020-06-09 08:53:40 · 390 阅读 · 0 评论