`
xtuhcy
  • 浏览: 139156 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
使用aspectj的注释方式实现aop 配置: <context:component-scan base-package="com.aspire.nmp" /> <aop:aspectj-autoproxy proxy-target-class="true"/>   代码: @Pointcut("bean(testServiceImpl)") public void testService() {   }   @Around("testService()") public Ob ...
要在spring中使用hibernate的延迟加载,我们先要模拟一个延迟加载的场景。 hibernate的get和load的区别相信大家都知道,load是通过代理加载实体,如果只访问id是不会读库将所有属性加载进来的,这个就是一个延迟加载的简单场景。 ...
转自http://www.blogjava.net/landor2004/archive/2009/11/25/303701.html Hibernate session FlushMode有五种属性: 1、NEVEL:已经废弃了,被MANUAL取代了 2 MANUAL: 如果FlushMode是MANUAL或NEVEL,在操作过程中hibernate会将事务设置为readonly,所以在增加、删除或修改操作过程中会出现如下错误 org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not ...
奇怪的junit测试spring应用问题,找不到property-placeholder:   <context:property-placeholder location="classpath*:*.properties"/>   原因就在classpath*:*.properties 不能写成classpath:*.properties   哪位熟悉spring的property-placeholder原理的请解释一下这是为啥?“classpath*”是什么意思?

redis配置说明

redis.conf配置选项如下:daemonize 是否以后台进程运行,默认为nopidfile 如以后台进程运行,则需指定一个pid,默认为/var/run/redis.pidbind 绑定主机IP,默认值为127.0.0.1(注释)port 监听端口,默认为6379timeout 超时时间,默认为300(秒)loglevel 日志记录等级,有4个可选值,debug,verbose(默认值),notice,warninglogfile
目录 一、数据库事务的定义 二、数据库事务并发可能带来的问题 三、数据库事务隔离级别 四、使用Hibernate设置数据库隔离级别 五、使用悲观锁解决事务并发问题 六、使用乐观锁解决事务并发问题     Hibernate事务与并发 ...
这个方法都是hibernate 的保存方法 merge() : 1.如果对象的idertifier(以下简称为id)为空或在数据库不存在,则进行inert动作(此时如果对象的id有值也 将被hibernate自动生成的ID覆盖)2.如果id存在,则进行update动作 replicate() : Persist the state of the given detached instance, reusing the current identifier value 使用背景: 假设你的对象的ID是用hibernate 负责生成的,但现在你想在数据库中插入一条已经指定ID的记录, ...
AOP的方法被调用2次,很是奇怪,最后发现是bean相互引用引起的,具体原理不知。 解决办法,在拦截器类中通过taget获得需要引用的方法。   如: ServiceA引用了ServiceB ServiceB引用了ServiceA ServiceA中有拦截器Interceptor Interceptor引用了ServiceB   此时Interceptor中的方法会被调用2次 解决版本就是Interceptor不引用ServiceB,还是通过((ServiceA)Target).getServiceB来获得ServiceB  
http协议里控制浏览器缓存的头有三个Cache-Control,Expires,Last-Modified对于静态页面还有Etag。一、先来看第一种情况:apache 静态页面apache发送给客户端的静态页面一般包含Last-Modified和Etag,这两个标签的值来自静态文件的修改时间 ...

算法3

    博客分类:
  • java
A non-negative integer is called heavy if the average value of its digits in decimal representation exceeds 7. Assume that 0 has an average value of its digits equal to 0. For example, the number 8,698 is heavy because the average value of its digits is (8+6+9+8)/4 = 7.75. The number 53,141 has an ...

算法2

    博客分类:
  • java
A zero-indexed array A consisting of N integers is given. The dominator of array A is the value that occurs in more than half of the elements of A. For example, consider array A such that   A[0] = 3 A[1] = 4 A[2] = 3 A[3] = 2 A[4] = 3 A[5] = -1 A[6] = 3 A[7] = 3   The dom ...
A string is a palindrome if it has exactly the same sequence of characters when read left-to-right as it has when read right-to-left. For example, the following strings are palindromes: "kayak", "codilitytilidoc", "neveroddoreven". A string A is an anag ...
VisualVM是jvm的可视化监控工具   下载地址:http://visualvm.java.net/download.html   监控本地jvm很简单,这里不详细说了。 监控远程jvm的方法有2种 一、远程服务器启动jstatd守护进程 ./jstatd -J-Djava.security.policy=jstatd.all.policy -J-Djava.rmi.server.hostname=192.168.0.50 -J-Djava.rmi.server.logCalls=true -p 1011     1、 在JDK/bin下新建一文本文件, 名称 jsta ...
一、对象引用 1、引用计数器算法不能解决对象相互引用带来的无法释放的问题,大多数jvm采用根搜索算法。 2、引用分为Strong Reference,Soft Reference,Weak Reference,Phantom Reference      强引用是我们最常用的如A a = new A();      软引用SoftReference,是在内存不够的情况下,即使没有达到可回收的标准也强制回收;      弱引用是在每次垃圾回收是都强制被回收;      虚引用,用的很少,目的是为了在GC是获得一个通知而已。     二、垃圾收集算法 1、老年代采用“标记清理”或 ...
程序计数器 线程私有,可以看做是当前线程所执行的字节码的行号指示器 栈:分为虚拟机栈和本地方法栈 1、栈都是线程私有的。虚拟机栈描述的是java方法执行的内存模型,本地方法栈描述的是native方法执行的内存模型。 2、栈可动态扩展,对应虚拟机启动参数:-Xss(线程栈大小)   堆:分为方法区和GC堆,也有人划分为永生代、老年代、新生代(新生代又分为eden、From Survivor、To Survivor)1、GC堆是线程共享的区域,此区域的唯一目的就是存放对象实例,对应虚拟机启动参数:Xmx(最大堆内存)。 GC堆:新生代,老年代; 新生代:Eden空间,From Survivor ...
Global site tag (gtag.js) - Google Analytics