从Java EE 5规范开始,Servlet中增加了两个影响Servlet生命周期的注解(Annotion):@PostConstruct和@PreDestroy.这两个注解被用来修饰一个非静态的void()方法.写法有如下两种方式: @PostConstruct Public void someMethod() {} 或者 public @PostConstruct void someMethod(){} 被@PostConstruct修饰的方法会在服务器加载Servle的时候运行,并且只会被…
position有五个值:static.relative.absolute.fixed.inherit. static 是默认值.就是按正常的布局流从上到下从左到右布局,平常我们做网页制作时,没有指定 position,也就表示使用 static. relative 没有脱离布局流,此时可以使用 top.right.bottom.left 属性. top 和 bottom 共存时,使用 top 值,忽略 bottom 值: left 和 right 共存时,使用 left 值,忽略 right…
不想看分析过程的,直接拉到最下面看第4部分 1. 问题背景 由于某些原因,项目中使用了hibernate3与ehcache-2.8.3在配合使用,又由于某些原因,需要使用多个SessionFactory实例.在这个背景下,启动项目报错,具体异常如下: Caused by: net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM. Please provide unique…
1. enable_if 原理 关于 enable_if 原理这里就不细说了,网上有很多,可以参考如下教程,这里只讲解用法实例,涵盖常规使用全部方法. 文章1 文章2 文章3 1. 所需头文件 #include <type_traits> 2. 返回参数特化 //the return type (bool) is only valid if T is an integral type template <typename T> typename std::enable_if<…