2012年12月21日
摘要:
org.springframework.beans.factory包下有一个接口是InitializingBean 只有一个方法:/** * Invoked by a BeanFactory after it has set all bean properties supplied * (and satisfied BeanFactoryAware and ApplicationContextAware). * <p>This method allows the bean instance to perform initialization only * possible when
阅读全文
posted @ 2012-12-21 12:01
cfd406635982
阅读(27592)
推荐(0)
2012年12月19日
摘要:
在配置spring事务传播行为的时候,如果在一个类里有多个方法class A{public addA(){//something...}public addB(){//something...}public addAll(){addA();addB();}}如:addB 和 addAll的传播行为为REQUIRE如果addA的传播行为为REQUIRES_NEW当调用addAll的时候并不会给addA()重新开启一个事务,而是在addAll事务之中因为spring的AOP和动态代理的的原因:在一次方法调用过程中一个类中的方法只会被代理一次,不会被多次代理,而且代理的是调用的那个方法。所以如果调用
阅读全文
posted @ 2012-12-19 11:03
cfd406635982
阅读(502)
推荐(0)
2012年12月18日
摘要:
继承以下类即可:import org.hibernate.FlushMode;import org.hibernate.Session;import org.hibernate.SessionFactory;import org.junit.After;import org.junit.Before;import org.junit.runner.RunWith;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.orm.hibernate3.SessionFactor
阅读全文
posted @ 2012-12-18 15:15
cfd406635982
阅读(2518)
推荐(0)
2012年11月25日
摘要:
一般的复制1. cp /源文件 /目标文件夹 (:把源文件放到文件夹下)2. cp /源文件 /目标文件名 (:把源文件命名为“目标文件夹名”)3.如果是要复制文件夹则需要加上-R,否则只能复制当前空文件夹4.如果原来的文件夹下面有很多重名的文件夹,这时候会提示是否覆盖 但是如果需要覆盖很多文件的话,一个一个确认很麻烦,这个时候加上一个-f参数 但是有些linux的cp的时候实际是别名cp -i,所以会提示,这时候加上-f也没有用。解决办法是:alias cp="cp -f"这个临时有效。但是最好还是临时的最好,因为平时还是提醒比较好。============tail -n
阅读全文
posted @ 2012-11-25 19:55
cfd406635982
阅读(13792)
推荐(0)
2012年10月28日
摘要:
Linux文件的压缩备忘(转).tar解包:tar xvf FileName.tar打包:tar cvf FileName.tar DirName (注:tar是打包,不是压缩!)———————————————.gz解压1:gunzip FileName.gz解压2:gzip -d FileName.gz 压缩:gzip FileName.tar.gz 和 .tgz解压:tar zxvf FileName.tar.gz压缩:tar zcvf FileName.tar.gz DirName———————————————.bz2解压1:bzip2 -d FileName.bz2解压2:bunzip
阅读全文
posted @ 2012-10-28 15:46
cfd406635982
阅读(255)
推荐(0)
摘要:
1.首先下载工具:http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html2. 执行传输用的是PSCP:C:\Users\jack\Desktop\Maven>pscp -P 22 d:/a.txt root@192.168.1.109:/test/root@192.168.1.109's password:其中22是端口号要传送的文件路径:d:/a.txt传输后存放的路径: /test
阅读全文
posted @ 2012-10-28 15:15
cfd406635982
阅读(167)
推荐(0)
2012年10月17日
摘要:
/** 1. 定义一个Cat类 **/var Cat = { getInstance: function(){ var cat = {}; car.name="jerry"; cat.shout = function(){ alert("miao~miao~"); }; return cat; }};var cat = Cat.getInstance();alert(cat.name);/** 2. 继承 **/var Animal = { getInstance: function(){ var animal = {}; animal.type=&qu
阅读全文
posted @ 2012-10-17 14:23
cfd406635982
阅读(214)
推荐(0)
2012年9月11日
摘要:
<script type="text/javascript">var outObj = { type :"java"}function innerM(){ var p; alert(p);//undefined alert("k:"+k);//error--innerObj未定义 alert(outObj.jack);//undefined alert(innerObj.jack);//error--innerObj未定义}innerM();</script><script type="text
阅读全文
posted @ 2012-09-11 13:31
cfd406635982
阅读(8069)
推荐(1)
2012年8月10日
摘要:
/** * 文件名: Customer.java * * 顾客 * **/public class Customer{ @SuppressWarnings("unused") private Shop shop = null; private String name = null; public void buy(){ int count = shop.getBreadCount(); if(count > 0){ shop.setBreadCount(--count); System.out.println(name +" says : I bought
阅读全文
posted @ 2012-08-10 15:13
cfd406635982
阅读(1044)
推荐(0)
摘要:
package com.cfd.thread;/** * 死锁 * @author cfd * */class DLockThread extends Thread{ static Object a = new Object(); static Object b = new Object(); String firstObj = ""; public DLockThread(String firstObj, String threadName){ this.firstObj = firstObj; super.setName(threadName); } public vo
阅读全文
posted @ 2012-08-10 14:01
cfd406635982
阅读(313)
推荐(0)