为您找到相关文章135篇
-
[温故]Java 字符串对象池的作用
2018-05-10 从Java5.0开始,Java虚拟机在启动的时候回实例化9个对象池。这9个对象池分别用来存储8中基本类型的包装类对象和String对象,主要是为了效率问题。大家应该知道,创建String对象有俩种办法,代码如下:String str1="hello"; String str2=new String("hello");这俩种创建String对象的方法有什么区别吗?区别就在于第一种方法在对象池中取对象,第二种方法直接生成新的对象。当在程序中直接用双引号引起来一个字符串时,Java虚拟机(JVM)就到String的对象池中就去检查是否有一个值相同的对象。如果有,就取现成的对象;如果没有则... -
ORA-28002: the password will expire within 5 days
2018-04-18 异常信息如下:2018-04-18 08:39:02,494 INFO method:com.mchange.v2.c3p0.SQLWarnings.logAndClearWarnings(SQLWarnings.java:43) - ORA-28002: the password will expire within 5 days java.sql.SQLWarning: ORA-28002: the password will expire within 5 days at oracle.jdbc.driver.DatabaseError.addSqlWarni... -
[转]JAVA多线程实现的四种方式
2018-04-18 这是网上一篇关于介绍多线程的一篇文章,个人感觉总结的很不错。顺便自己也收藏了。Java多线程实现方式主要有四种:继承Thread类、实现Runnable接口、实现Callable接口通过FutureTask包装器来创建Thread线程、使用ExecutorService、Callable、Future实现有返回结果的多线程。 其中前两种方式线程执行完后都没有返回值,后两种是带返回值的。1、继承Thread类创建线程 Thread类本质上是实现了Runnable接口的一个实例,代表一个线程的实例。启动线程的唯一方法就是通过Thread类的start()实例方法。start()方... -
关于Spring任务调度@Scheduled的外部配置方法
2018-03-28 在使用过Quartz过的人应该都清楚,Quartz的cron表达式是可以在外部的配置文件中配置的。那么Spring的任务调度@Scheduled 中cron可以在外部配置么?如果可以又怎么配置呢?先抛出来一个引子(PS:急性子朋友可以直接跳过往下看哦~ )。下面就以一段Demo为例:在xml中:<!-- 开启Spring注解 --> <context:annotation-config/> <!-- 扫描 Task 包 --> <context:component-scan base-package="com.baikeyang.ta... -
instanceof与getClass的区别
2018-03-26 在java中,在比较一个类是否和另一个类属于同一个类实例的时候,我们通常可以采用instanceof和getClass两种方法通过两者是否相等来判断,但是两者在判断上面是有差别的,通过下面从演示代码中就可以看出区别:public class Test { public static void testInstanceof (Object x) { System.out.println("x instanceof Parent: "+(x instanceof Parent)); System.out.println("x instanceof C... -
[转]log4j中log.isDebugEnabled(), log.isInfoEnabled()和log.isTraceEnabled()作用
-
[转]Ibatis传入数组或List类型参数小结
-
在Spring 中 获取 request 对象
-
Thymeleaf 基本表达式
2018-01-09 如需了解Thymeleaf以及Thymeleaf整合Spring Boot,请参考《Spring boot 之 Web应用开发篇》、《Spring Boot 之 Thymeleaf 篇》。Thymeleaf的基本表达式有:${...} 变量表达式*{...} 选择变量表达式#{...} 消息表达式@{...} 链接url表达式#maps 工具对象表达式${}变量表达式:用于访问容器上下文环境中的变量,功能同jstl中${}。protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws Serv... -
Spring Boot 之 Thymeleaf 篇
2018-01-01 在Spring boot中,官方默认采用的是Thymeleaf模块引擎,通过org.springframework.boot.autoconfigure.thymeleaf包对Thymeleaf进行了自动配置。通过Thymeleaf2Configuration类对集成所需要的Bean进行自动配置,包括templateResolver、templateViewResolver 和templateEngine 的配置。通过ThymeleafProperties来配置Thymeleaf,在application.properties中以 spring.thymeleaf开头来配置,通过查看Th... -
JavaScript将数组字符串转数组对象的方法
2017-12-27 在JavaScript,如何将数组字符串转数组对象呢?可以利用强大的eval函数可以实现。如有一个数组字符串 [7,9,16,5] ,使用eval就可以将该字符串转换为数据。具体实现如下:var arrayText = "[7,9,16,5]"; console.log( arrayText );// 打印数组字符串 var array = eval( "(" + arrayText + ")" ) console.log( array );// 打印数组对象可以从控制台看出, [7,9,16,5]数组字符串已经被转换为一个数组对象,并具有了数组的特性,如果长度、方法等。 -
Jquery圣诞节特效
2017-12-25 为了庆祝圣诞节(其实是为了悼念我这毫无收获的一年),自己手动给博客换了一个圣诞节的特效。该特效需要依赖Jquery和Jquery snow插件。不废话,直接上代码了:<!-- 引入jquery snow插件 --> <script type="text/javascript" src="/js/jquery.snow.js"></script> <script type="text/javascript"> var snowEffectInterval = jQuery.fn.snow({ // min size of el...