- 博客(22)
- 收藏
- 关注
原创 网络通信-初识netty
nettyBootstrap、ServerBootstrap:Future、ChannelFuture:Channel:Selector:NioEventLoop:NioEventLoopGroup:ChannelHandler:ChannelHandlerContext:ChannelPipline:
2021-06-28 21:41:58
146
原创 设计模式-原型模式
原型模式public class Prototype { public static void main(String[] args) throws CloneNotSupportedException { Product product = new Product(); product.setName("abc"); System.out.println(product); Product clone = product.clo
2021-06-28 20:06:17
136
原创 设计模式-享元模式
享元模式,指数据共享public class FlyWeight { public static void main(String[] args) { TreeNode treeNode = new TreeNode(3, 4, TreeFactory.getTree("a")); System.out.println(treeNode); }}class TreeNode { private int x; private int
2021-06-28 20:06:10
133
原创 设计模式-门面模式
门面模式:为一组接口提供一个一致的接口,门面模式定义了一个高层接口,使得子系统便于使用。public class Facade { public static void main(String[] args) { Client client = new Client(); client.doSomething(); }}class Client { Util util = new Util(); public void doSom
2021-06-28 20:06:02
123
原创 设计模式-适配器模式
适配器模式主要解决兼容问题对象适配器模式,类的适配器模式对象适配器模式public class AdapterMode1 { public static void main(String[] args) { Adapters adapters = new Adapters(new Adapter()); System.out.println(adapters.output5()); }}class Adapter { public
2021-06-28 20:05:54
102
原创 设计模式-装饰者模式
装饰者模式,应用场景,扩展功能public class DecorateMode { public static void main(String[] args) { Component c = new ConDec222(new ConDec(new ConcreteComponent())); c.operation(); }}interface Component { void operation();}class Concre
2021-06-28 20:05:47
76
原创 设计模式-策略模式
策略模式public class StrategyTest { public static void main(String[] args) { Normal normal = new Normal(); normal.diaplay(); normal.attack(); normal.move(); }}interface Moveable { void move();}interface Atta
2021-06-28 20:05:39
117
原创 设计模式-模板方法
模板方法:执行的特定步骤到子类public class TemplateMode { public static void main(String[] args) { AbstractClass subClass = new SubClass(); subClass.operation(); subClass.template(); }}abstract class AbstractClass { public void o
2021-06-28 20:05:31
85
原创 设计模式-观察者模式
观察者模式public class ObserverMode { public static void main(String[] args) { Subject subject = new Subject(); Task1 task1 = new Task1(); subject.add(task1); subject.add(new Task2()); subject.notifyObserver("xx");
2021-06-28 20:05:22
98
原创 设计模式-责任链模式
责任链模式public class ChainOfResponsibility { public static void main(String[] args) { Request request = new Request(false, true, true, true); RequestFreHandler requestFreHandler = new RequestFreHandler(new LoginHandler(null)); i
2021-06-28 20:05:13
89
原创 集合框架之LinkedList源码分析(JDK1.8)
LinkedList<E> extends AbstractSequentialList<E> implements List<E>, Deque<E>, Cloneable, java.io.SerializableLinked代表的是链表,类似于下图:LinkedList使用Node存储数据private static cl...
2021-06-26 16:40:01
123
原创 集合框架之ArrayList源码分析(JDK1.8)
ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, java.io.SerializableArrayList继承自AbstractList,这和Vector是一样的,实现了List接口,所以兼具两者的方法。ArrayList<In...
2021-06-26 16:39:54
168
原创 集合框架之HashMap源码分析(JDK1.8)
HashMap<K,V> extends AbstractMap<K,V> implements Map<K,V>, Cloneable, Serializable HashMap是我们最常用的存储数据的对象,相信大部分同学都知道HashMap的底层是数组+链表实现的,默认的初始容量为16,而扩容因子为0.75,这两个值在创建对象的时候是可以通过参数显示指...
2021-06-26 16:39:45
123
原创 怎么在idea的设置里面去掉Field injection is not recommended讨厌的提示
想必有代码规范的码友们都不会喜欢这么一个黄色的背景提示,太刺眼了。当然了,出现这个提示的原因是多种多样的,spring有自己的解释,不过我们码代码码的时间久了往往会养成自己的习惯,大家都这样写,我也这样写,有错吗?当然没有!@Autowired // --Field injection is not recommendedPrintManager printManager;...
2021-06-26 16:39:33
909
原创 怎么开启Centos7的网络连接,可以互相ping通
我们知道在windows上刚完成安装的虚拟机默认是不联网的,那么怎么开启网络连接呢?A:首先我们需要关闭虚拟机的网络防火墙以便外部的系统可以访问虚拟机在终端输入命令systemctl stop firewalld #关闭防火墙systemctl disable firewalld #开机禁用防火墙B:把网络设置配置成NAT模式1.查看编辑器我...
2021-06-26 16:39:22
1198
原创 集合框架之Vector源码分析(JDK1.8)
Vector<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, java.io.Serializable从上述代码可以看出来Vector集合继承了AbstractList抽象类实现了List接口,所以它兼具AbstractList和List抽象方法,当我们new...
2021-06-26 16:39:11
188
原创 设计模式-抽象工厂
public class AbstractFactory { public static void main(String[] args) { IDatabaseUtils iDatabaseUtils = new MysqlDatabaseUtils(); IConnect connection = iDatabaseUtils.getConnection(); connection.connect(); ICommand comm.
2021-06-26 16:11:29
102
原创 设计模式-工厂方法
public class FactoryMethod { public static void main(String[] args) { Product product = SimpleFactory.createProduct(); }}class SimpleFactory { public static Product createProduct() { return new ProductA(); }}interfac.
2021-06-26 15:59:36
79
原创 设计模式-单例模式
1.懒汉模式public class LazySingleton { private static LazySingleton instance; private LazySingleton() { } public static LazySingleton getInstance() { if (instance == null) { synchronized (LazySingleton.class) {
2021-06-26 15:08:44
83
原创 mysql主从复制同步(亲测有效,windows适用)
*************************************************耐心点,这个方法可以成功*****************************************************一,下载mysql(mysql官网下载,我使用的是安装版的mysql,版本为8.0.13)。二,在两台windows上分别安装mysql,安装教程自行百度。三,...
2018-12-11 17:48:12
681
原创 log4j配置文件配置及解读
说明:以下开发工具使用的是idea一:打开idea,创建一个Maven管理的web项目1. File->New->Module2.Maven->勾选Create from archetype->选中maven-archetype-webapp3.填入GroupId 和ArtifactId (这儿的内容随意),然后一路点默认的Next4.创建好......
2018-11-06 08:44:09
5719
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人