fastjson 指定系列化格式
摘要:public static void main(String[] args) { List<User> list = new ArrayList<>(); list.add(new User(1,"11","11")); list.add(new User(2,"22","22")); list.a
阅读全文
Collectors 类
摘要:利用java8新特性,可以用简洁高效的代码来实现一些数据处理。 定义1个Apple对象: public class Apple { private Integer id; private String name; private BigDecimal money; private Integer n
阅读全文
@Qualifier 注解指定装备特定的bean
摘要:public interface TestService { String test(); } @Service("aTestService") public class ATestServiceImpl implements TestService{ @Override public String
阅读全文
Java中的finally 和return
摘要:直接上代码 public static int a(){ int i = 1; try{ i++; return ++i; }catch(Exception e){ }finally { if(i > 1){ System.out.println(" i = " + i);// i = 3 } }
阅读全文
String hashCode 方法为什么选择数字31作为乘子
摘要:String hashCode 的实现方法 public int hashCode() { int h = hash; if (h == 0 && value.length > 0) { char val[] = value; for (int i = 0; i < value.length; i+
阅读全文
Disruptor框架
摘要:知识点1:什么是Disruptor Disruptor使用观察者模式, 主动将消息发送给消费者, 而不是等消费者从队列中取; 在无锁的情况下, 实现queue(环形, RingBuffer)的并发操作, 性能远高于BlockingQueue 知识点2:Disruptor的设计方案 Disruptor
阅读全文
http框架--Forest 的使用
摘要:引入jar包 <dependency> <groupId>com.dtflys.forest</groupId> <artifactId>spring-boot-starter-forest</artifactId> <version>1.3.0</version> </dependency> 定义
阅读全文
SQL 语句大全
摘要:一、基础 1、说明:创建数据库CREATE DATABASE database-name2、说明:删除数据库drop database dbname3、说明:备份sql server 创建 备份数据的 deviceUSE masterEXEC sp_addumpdevice 'disk', 'tes
阅读全文