springboot 自动配置 自动监控demo
摘要:1、注解定义 @Target({java.lang.annotation.ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface Ump { public abstract Stri
阅读全文
log4j2.xml
摘要:<?xml version="1.0" encoding="utf-8"?> <configuration> <properties> <!-- 文件输出格式 --> <property name="PATTERN">%d{yyyy-MM-dd HH:mm:ss.SSS} |-%-5level [%
阅读全文
java aop 打印controller的入参和出参
摘要:package com.sleep.demo.intercepter; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ArrayUti
阅读全文
java 读取json文件到对象
摘要:1、新建json文件 [ { "id": 1, "name": "酒水专区", "imageUrl": "7cf/e61b0aec87f07393.png", "previewImageUrl": "/9f8d4360d3a125b5.png" }, { "id": 2, "name": "日用百货
阅读全文
springboot HandlerIntercept
摘要:1、新建上下文类工具类 public class ContextHolder { private static final InheritableThreadLocal<RequestContext> REQUEST_CONTEXT_INHERITABLE_THREAD_LOCAL = new In
阅读全文
定时300 + 300 随机缓存类
摘要:@Component public class ProductCacheKeyService { private static String PRODUCT_BASE_INFO = "product_info_%s"; //商品信息BIG KEY private Random random = ne
阅读全文
zookeeper的安装
摘要:zookeeper的安装1、下载wget --no-check-certificate --no-cookies https://downloads.apache.org/zookeeper/zookeeper-3.8.0/apache-zookeeper-3.8.0-bin.tar.gz2、解压t
阅读全文
jdk1.8的安装 linux
摘要:1、下载 wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/
阅读全文
springboot 配置类
摘要:@Data @ConfigurationProperties(prefix = "recruitment.config") @Component public class RecruitmentConfigProperty { /** * 完成招募跳转url */ private String co
阅读全文
redis distributed lock redis分布式锁试下
摘要:@Resourceprivate DistributedRedisLockTemplate lockTemplate;String distributedKey="lockKey" ; DistributedLockCallback<String> callback = new Distribute
阅读全文
restTemplate 使用1
摘要:public String getCode(String jsCode) { try { String url= "http://www.baidu.com" ResponseEntity responseEntity = restTemplate.getForEntity(url, WeChatS
阅读全文
restTemplate post使用
摘要:private String generateScheme(GetWechatSchemeReq req, String accessToken) { String path = req.getPath(); String query = req.getQuery(); String url = "
阅读全文