JAVA 第18页
单例模式/单件模式的两种实现方式-Ddmit

单例模式/单件模式的两种实现方式

单件模式就是要保证一个类只有一个实例。 //第一种形式,饿汉式: public class Singleton { //private 类型的静态变量 private static Singleton instance = new Singleton(); //构造函数为pri...
ddmit的头像-DdmitDdmit6年前
016800
Web开发中的URL编码(Java中URL地址乱码的解决方法)-Ddmit

Web开发中的URL编码(Java中URL地址乱码的解决方法)

Web开发离不开URL,URL就是网址,网络标准规定:只有字母和数字[0-9a-zA-Z]、一些特殊符号“$ – _ . + ! * ‘ ( ) , ”[不包括双括号]、以及某些保留字,才可以不经过编码直接用于URL。 因此,...
ddmit的头像-DdmitDdmit6年前
016760
Spring Boot读取jar包文件错误解决-Ddmit

Spring Boot读取jar包文件错误解决

从jar包中读取classpath下文件出错: java.io.FileNotFoundException: class path resource [conf/sendofd.xml] cannot be resolved to absolute file path because it does not reside in the ...
ddmit的头像-DdmitDdmit5年前
016730
使用ant打包出现OutOfMemoryError Java heap space错误-Ddmit

使用ant打包出现OutOfMemoryError Java heap space错误

当使用Ant编译大量的Java源文件时,会出现java.lang.OutOfMemoryError:Java heap space异常,解决方法: <target name='compile' depends='init,create-manifest' description='compile the ...
ddmit的头像-DdmitDdmit6年前
016600
如何将Map键值的下划线转为驼峰-Ddmit

如何将Map键值的下划线转为驼峰

例,将HashMap实例extMap键值下划线转为驼峰: 代码: HashMap<String,Object> extMap = new HashMap<>(); extMap.put('ORGAN_NAME','四个空格'); extMap.put('WEB_SITE','https://...
ddmit的头像-DdmitDdmit6年前
016551
Java中通过JMX监控Jboss代码示例(应用服务器监控篇5)-Ddmit

Java中通过JMX监控Jboss代码示例(应用服务器监控篇5)

本文提供了一种监控Jboss性能信息的方式——Jmx,通过这种方式监控的前提是要先配置好jboss的Jmx功能,具体的配置方法,前面已经详细记述过。 当配置好Jmx后,我们通过jconsole可以看到Jboss的...
ddmit的头像-DdmitDdmit6年前
016480
Java正则表达式完全攻略及实战-Ddmit

Java正则表达式完全攻略及实战

正则表达式语法 单个字符类 1.字符x 说明:没错,它表示的就是单个字母x。 示例代码: System.out.println('我是字母x吗?=='+'x'.matches('x')); System.out.println('我是字母x吗?=='+'a'.ma...
ddmit的头像-DdmitDdmit6年前
016400
Java统计一个字符串在一个文件中出现的次数-Ddmit

Java统计一个字符串在一个文件中出现的次数

Java统计一个字符串在一个文件中出现的次数,具体代码如下: package demo; import java.io.FileReader; import java.io.Reader; /** * 统计一个字符串在文件中出现的次数 * * @author 四个空格...
ddmit的头像-DdmitDdmit6年前
016321
使用google gson对json字符串和Java对象进行转换-Ddmit

使用google gson对json字符串和Java对象进行转换

使用google gson对json字符串和Java对象进行转换 java对象转换为json字符串 转换代码 /** * @author 四个空格-https://www.4spaces.org/ */ public class JavaToJsonDemo { public static void ...
ddmit的头像-DdmitDdmit6年前
016230
Spring Boot各个版本修改文件上传大小限制-Ddmit

Spring Boot各个版本修改文件上传大小限制

Springboot上传文件报错信息如下: Maximum upload size exceeded; nested exception is java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.impl.FileSizeLimitExceede...
ddmit的头像-DdmitDdmit4年前
016230