![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
编程技能
suvue
代码改变世界
展开
-
LocalDateTime造成的java对象反序列化出错的问题
解决方案:redisConfig配置类:package cn.suvue.discipline.core.config;import com.fasterxml.jackson.annotation.JsonAutoDetect;import com.fasterxml.jackson.annotation.JsonTypeInfo;import com.fasterxml.jacks...原创 2019-12-22 16:20:51 · 3939 阅读 · 1 评论 -
Centos7下使用docker下快速安装redis
Centos7下使用docker下快速安装redis取最新版的 Redis 镜像docker pull redis:latest查看本地镜像docker images运行容器docker run -itd --name redis-service -p 6379:6379 redis-p 6379:6379:映射容器服务的 6379 端口到宿主机的 6379 端口。外部可以直...原创 2019-12-22 14:15:38 · 206 阅读 · 0 评论 -
mysql中union,union all 与order by 的常见用法
注意点:多个复合查询使用一个orderby时,注意用AS后的属性名才行!例如:SELECT user_name AS userName,sco_re AS score FROM t1 WHERE user_name LIKE '王%'UNIONSELECT user_name AS userName,sco_re AS score FROM t1 WHERE user_name LIK...原创 2019-12-19 10:41:17 · 318 阅读 · 0 评论 -
一文读懂Java对象初始化的先后顺序
阿里面试题:Java对象初始化package com.vuesu.infanta.core;/** * 对象初始化demo * * @author vue Su * @date 2019/10/14 */public class InitializeDemo { private static int k = 1; private static InitializeD...原创 2019-10-14 17:42:27 · 92 阅读 · 0 评论 -
对WebMvcConfigurationSupport类的理解
对WebMvcConfigurationSupport类的理解官方介绍This is the main class providing the configuration behind the MVC Java config.It is typically imported by adding {@link EnableWebMvc @EnableWebMvc} to an applicati...原创 2019-10-14 16:40:55 · 5372 阅读 · 1 评论 -
springBoot项目中,Java类的静态变量获取yml中属性值
通过set方法进行赋值yml:spring datasource url: XXXjava类:public class DbHelper(){ private static String url; @Value("${spring.datesource.url}") public void setUrl(String url) { DbHelper...原创 2019-10-14 16:35:13 · 1613 阅读 · 0 评论 -
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure最简单有效的解决方案
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failureThe last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets fro...原创 2019-09-17 13:26:06 · 736 阅读 · 1 评论 -
java如何利用字节流实现文件之间的相互复制
代码奉上~public static void fileCopy(File src,File target) throws IOException { InputStream in = new FileInputStream(src); FileOutputStream out = new FileOutputStream(target); byte[] buffer = new b...原创 2019-09-12 16:48:18 · 216 阅读 · 0 评论 -
递归获取电脑上某一文件夹下的所有文件名
直接上代码:public static void listAllFiles(File dir){ if (null == dir || !dir.exists()){ return; } if (dir.isFile()){ System.out.println(dir.getName()); return; } for (File file:dir.lis...原创 2019-09-12 15:40:54 · 467 阅读 · 0 评论 -
String的常量池你知道这一点吗?
废话无益,直接代码奉上~public static void main(String[] args){ String a = new String("aaa"); String b = new String("aaa"); System.out.println(a==b); //==>false 在堆内存创建了两个对象 String c = a.intern(); ...原创 2019-09-12 14:58:34 · 89 阅读 · 0 评论 -
idea怎么设置Integer常量池的上限值
我们知道,Integer默认的常量池大小是-128~127,如图所示:只要我们使用的是这个范围内的Integer包装类型的值,那么就一直会从缓存池中获取。这可真是一次存入,终生获取呀!我们考虑下这个情况哈,比如一个热点代码块,对某一范围内的数字使用很频繁,这个时候为了考虑性能优化,我们会想办法把这些也存入到常量池中吧,到底怎么实现呢?这里使用idea编辑器进行演示:没有改变大小前,返...原创 2019-09-12 14:15:54 · 911 阅读 · 0 评论