Conditional 注解

Spring条件注解@Conditional @Conditional是Spring4新提供的注解,它的作用是根据某个条件创建特定的Bean,通过实现Condition接口,并重写matches接口来构造判断条件。总的来说,就是根据特定条件来控制Bean的创建行为,这样我们可以利用这个特性进行一些自动的配置。 ...

January 30, 2021 · 2 min

linux操作命令

liunx端口c操作 1、开启防火墙 systemctl start firewalld 2、开放指定端口 firewall-cmd --zone=public --add-port=5601/tcp --permanent 命令含义: --zone #作用域 --add-port=1935/tcp #添加端口,格式为:端口/通讯协议 --permanent #永久生效,没有此参数重启后失效 3、重启防火墙 firewall-cmd --reload 4、查看端口号 netstat -ntlp //查看当前所有tcp端口· netstat -ntulp |grep 9200 //查看所有1935端口使用情况· 5、查看开放的端口号 ...

January 30, 2021 · 2 min

SpringBoot 在IDEA中实现热部署 (JRebel实用版)

SpringBoot 在IDEA中实现热部署 (JRebel实用版) JRebel插件安装步骤: 在setting - Plugins 里面搜索 JReble 激活链接: System.out.println("https://jrebel.qekang.com/6f540b75-a1f5-4ccc-ae32-d00e12eda632"); System.out.println("[email protected]"); 准备条件 File–>Serrings–>Compiler–>找到Build project automatically勾选上,代表自动编译 ...

January 30, 2021 · 1 min

springboot三种系统初始化方式解析

springboot三种系统初始化方式解析 1. 第一种 利用 spring.factories 在资源文件目录建立 spring.factories 文件 存入key-value信息 org.springframework.context.ApplicationContextInitializer=com.zhu.ggball.springboot.initializer.FirstInitializer 实现 ApplicationContextInitializer 类 /** * @program: springboot * @description: 第一种初始化方式 * @author: ggBall * @create: 2021-01-13 09:16 **/ @Order(1) public class FirstInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> { @Override public void initialize(ConfigurableApplicationContext applicationContext) { // 1. 获取环境 ConfigurableEnvironment environment = applicationContext.getEnvironment(); // 2. 构建自己的属性 HashMap<String, Object> map = new HashMap<>(); map.put("key1","value1"); MapPropertySource source = new MapPropertySource("firstInitializer", map); // 3. 加入环境属性集中 environment.getPropertySources().addLast(source); System.out.println("firstInitializer start... "); } } 原理: ...

January 30, 2021 · 2 min

springCache配合redis做缓存

springCache配合redis做缓存 redis的优势 我们都知道redis可以作为缓存,是因为它具有 大内存作为缓存 redis的缓存可以被持久化 redis可以实现分布式缓存 Redis可以处理每秒百万级的并发,是专业的绶存服务 redis对缓存有过期时间机制 Redis不仅仅支持简单的k/v类型的数据,同时还提供list,set,zset,hash等数据结构的存储。 什么是springCache 概述 Spring 3.1 引入了激动人心的基于凝视(annotation)的缓存(cache)技术,它本质上不是一个具体的缓存实现方案(比如EHCache 或者 OSCache),而是一个对缓存使用的抽象,通过在既有代码中加入少量它定义的各种 annotation,即能够达到缓存方法的返回对象的效果。 ...

January 30, 2021 · 6 min
总访问量 总访客数