![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JAVA
雷声科技
这个作者很懒,什么都没留下…
展开
-
单向链表设计LRU缓存
LRU是Least Recently Used的缩写,即最近最久未使用,常用于页面置换算法,是为虚拟页式存储管理服务的。常见的实现是将最近访问过的资源【引用】放一个队列,每次将新访问的放在队首,这样最不常用的就被放到队尾,当达到一定数量后,队尾的对象就被清除。缓存的应用场景很多,尤其是高并发的环境中,可以用来控制request数量。现在以一个单项链表为例,解释下如何来实现一个LRU。新建一个单向链表原创 2017-10-09 11:13:56 · 419 阅读 · 0 评论 -
spring+springMVC中使用@Transcational方式管理事务的配置方法
引用剑握在手的博客spring+springMVC中使用@Transcational方式管理事务的必须要配的东西。 spring中管理事务的配置方式除了@Transcational还有使用aop等,本文介绍@Transcational方式,但是推荐使用aop方式。因为如果有多个事务管理器的话,你在注解中还需要注明使用哪个事务管理器@Transactional(“transactionManager转载 2017-10-10 16:43:29 · 397 阅读 · 0 评论 -
checked exception和unchecked exception的区别
Java 提供了两种Exception 的模式,一种是执行的时候所产生的Exception (Runtime Exception),另外一种则是受控制的Exception (Checked Exception)。所有的Checked Exception 均从java.lang.Exception 继承而来,而Runtime Exception 则继承java.lang.RuntimeExceptio原创 2017-10-10 22:16:39 · 640 阅读 · 0 评论 -
JTA 分布式事务
分布式事务:一个事务涉及到要去操作位于不同服务器上的资源(数据库),这时就要去保证每个数据库里面的状态一致,如果出现异常还要去不同的数据库里面回滚。这里举一个实际的例子就是 同时修改两个数据库的表中内容 1. 配置两个datasource,利用JDBC模板方法配置两个JdbcTemplate<?xml version="1.0" encoding="UTF-8"?><beans xmlns="h转载 2017-10-19 22:11:59 · 270 阅读 · 0 评论 -
Spring和hibernate集成写API进行CRUD操作
配置maven引入spring 4和hibernate 4的依赖包: - spring-core - spring-webmvc - spring-orm - aspectjrt - hibernate-core - hibernate-entitymanager 另外引入必要的maven-plugin和junit用来跑unit test: - maven-compile原创 2017-10-13 11:17:46 · 388 阅读 · 0 评论 -
JPA 对象继承策略
Java persistence api最早是EJB的一部分,在EJB3时候被分离出来JPA1.0,之后出现了JPA2.0、2.1。不同公司发布了Hibernate, Eclipselink, Toplink, Spring Data JPA等。Generally, Java developers use lots of code, or use the proprietary framework原创 2017-10-14 20:55:59 · 396 阅读 · 0 评论 -
MyEclipse 错误提示 Can not find the tag library descriptor for XXX
在我的jsp里面引入了JSTL,如下所示:<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %><%@ taglib uri="http://www.springframework.原创 2017-10-17 13:21:21 · 10904 阅读 · 2 评论