??xml version="1.0" encoding="utf-8" standalone="yes"?>日本午夜精品视频在线观看,国产精品分类,欧美一区二区三区公司http://www.aygfsteel.com/leisure/category/49623.htmlJAVA - exceed,helloworldzh-cnFri, 11 Jan 2013 20:38:50 GMTFri, 11 Jan 2013 20:38:50 GMT60spring2 JNDIhttp://www.aygfsteel.com/leisure/archive/2013/01/11/394091.htmlleisureleisureFri, 11 Jan 2013 02:33:00 GMThttp://www.aygfsteel.com/leisure/archive/2013/01/11/394091.htmlhttp://www.aygfsteel.com/leisure/comments/394091.htmlhttp://www.aygfsteel.com/leisure/archive/2013/01/11/394091.html#Feedback0http://www.aygfsteel.com/leisure/comments/commentRss/394091.htmlhttp://www.aygfsteel.com/leisure/services/trackbacks/394091.html      <bean id= "myjndi" class= "org.springframework.jndi.JndiObjectFactoryBean" >
             <property name ="jndiName" value= "java:comp/env/jdbc/myjndi" />
      </bean >

leisure 2013-01-11 10:33 发表评论
]]>
spring method interceptorhttp://www.aygfsteel.com/leisure/archive/2012/07/11/382760.htmlleisureleisureWed, 11 Jul 2012 01:14:00 GMThttp://www.aygfsteel.com/leisure/archive/2012/07/11/382760.htmlhttp://www.aygfsteel.com/leisure/comments/382760.htmlhttp://www.aygfsteel.com/leisure/archive/2012/07/11/382760.html#Feedback0http://www.aygfsteel.com/leisure/comments/commentRss/382760.htmlhttp://www.aygfsteel.com/leisure/services/trackbacks/382760.html

spring method interceptor

-author: leisure.xu

首先dao里面有find和saveҎQ本实例以拦截findҎZQƈ改变find的返回倹{?/span>

package com.leisure;

public class Dao {

     public String find() {

          System. out.println( "dao: find()");

          return "student";

     }

     public void save() {

          System. out.println( "dao: save()");

     }

}

一、新增一个DaoInterceptor,如下

package com.leisure;

import org.aopalliance.intercept.MethodInterceptor;

import org.aopalliance.intercept.MethodInvocation;

/**

 * class description goes here

 * @author leisure.xu

 * @version 1.0.0, 2012 -6 -29

 */

public class DaoInterceptor implements MethodInterceptor {

     @Override

     public Object invoke(MethodInvocation invocation) throws Throwable {

          String methodName = invocation.getMethod().getName();

          if( "find".equals(methodName)) {

               System. out.println( "invocation modify the return result to 'teacher'");

               return "teacher";

          }

          return invocation.proceed();

     } 

}

     DaoInterceptor实现了MethodInterceptor的invokeҎQ在q里Q?/span>MethodInvocation参数可以获取到getArguments{数据,至于能做什么,你懂的?/span>

二、Dao跟DaoInterceptorq是没扯上关p,q时需要修改applicationContext.xml

     原来Q?/span>

     <bean id = "dao" class= "com.leisure.Dao"/>

修改为:

          <!--

      <bean id=" dao" class="com.leiusre.Dao"/>

     -->

     <bean id ="daoInterceptor" class="com.leisure.DaoInterceptor"/>

     <bean id ="dao" class= "org.springframework.aop.framework.ProxyFactoryBean" >

          <property name ="target">

               <bean class ="com.leisure.Dao" />

          </property >

          <property name ="interceptorNames">

               <list >

                    <value >daoInterceptor </value >

               </list >

          </property >

     </bean >

三、运行看效果Q?/span>

     ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml" );

     Dao dao = context.getBean(Dao. class);

     System. out.println(dao.find());

     dao.save();

l果Q?/span>

invocation modify the return result to 'teacher'

teacher

dao: save()

从结果可以看出invocation拦截了findҎQƈ且修改了其返回结果,而对象的findҎq没有执行到?/span>

该实例引用到的jar包:






leisure 2012-07-11 09:14 发表评论
]]>
eclipse安装svn客户?/title><link>http://www.aygfsteel.com/leisure/archive/2012/01/25/368879.html</link><dc:creator>leisure</dc:creator><author>leisure</author><pubDate>Wed, 25 Jan 2012 02:59:00 GMT</pubDate><guid>http://www.aygfsteel.com/leisure/archive/2012/01/25/368879.html</guid><wfw:comment>http://www.aygfsteel.com/leisure/comments/368879.html</wfw:comment><comments>http://www.aygfsteel.com/leisure/archive/2012/01/25/368879.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/leisure/comments/commentRss/368879.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/leisure/services/trackbacks/368879.html</trackback:ping><description><![CDATA[下蝲相应的插件版?br /><div><a >http://www.eclipse.org/subversive/downloads.php</a></div>把解压的内容攄eclipse\dropins\svn\目录下(svn目录不存在则创徏Q?br />完成后,重启eclipseQ重启完后,提示安装svn connectorQ选择一个安装即可,安装完后Q再一ơ重启?br />window - show view - other - svn 下即可以看到svn控制视图<img src ="http://www.aygfsteel.com/leisure/aggbug/368879.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/leisure/" target="_blank">leisure</a> 2012-01-25 10:59 <a href="http://www.aygfsteel.com/leisure/archive/2012/01/25/368879.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>hello,spring3http://www.aygfsteel.com/leisure/archive/2011/12/29/367494.htmlleisureleisureThu, 29 Dec 2011 08:02:00 GMThttp://www.aygfsteel.com/leisure/archive/2011/12/29/367494.htmlhttp://www.aygfsteel.com/leisure/comments/367494.htmlhttp://www.aygfsteel.com/leisure/archive/2011/12/29/367494.html#Feedback0http://www.aygfsteel.com/leisure/comments/commentRss/367494.htmlhttp://www.aygfsteel.com/leisure/services/trackbacks/367494.html
目整个l构如下Q?br />

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4      xmlns:p="http://www.springframework.org/schema/p"
 5      xsi:schemaLocation="http://www.springframework.org/schema/beans
 6      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
 7      
 8     <bean id="dao" class="Dao"/>
 9     
10 </beans>

1 
2 public class Dao {
3     public void find() {
4         System.out.println("dao: find()");
5     }
6 }
7 

 1 import org.springframework.context.ApplicationContext;
 2 import org.springframework.context.support.ClassPathXmlApplicationContext;
 3 
 4 public class Client {
 5 
 6     public static void main(String[] args) {
 7         ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
 8         Dao dao = context.getBean(Dao.class);
 9         dao.find();
10     }
11 }
12 


leisure 2011-12-29 16:02 发表评论
]]>
EJava代理模式之秘书MMhttp://www.aygfsteel.com/leisure/archive/2011/12/09/365943.htmlleisureleisureFri, 09 Dec 2011 01:54:00 GMThttp://www.aygfsteel.com/leisure/archive/2011/12/09/365943.htmlhttp://www.aygfsteel.com/leisure/comments/365943.htmlhttp://www.aygfsteel.com/leisure/archive/2011/12/09/365943.html#Feedback0http://www.aygfsteel.com/leisure/comments/commentRss/365943.htmlhttp://www.aygfsteel.com/leisure/services/trackbacks/365943.html
代理对象一般定义了一个与目标对象怼或相q的行ؓ。代理对象负责对真实模块调用Q这使得调用者与被调用者之间徏立了一个隔d?/div>
场景CZ说明Q老总说话都是很_Q每ơ发布一个消息时QL先将要内容交l秘书MMQ秘书MMl过一番美化后Q把消息公布出来?/div>

设老?BossQ秘书MM=MMProxy

于是单的代理有
1 public class Boss {
2     public void anounce(String content) {
3         System.out.println(content);
4     }
5 }

1 public class MMProxy {
2     public void anounce(String content) {
3         System.out.print("boss: 大家h意了Q?/span>");
4         new Boss().anounce(content);
5     }
6 }

new MMProxy().anounce("我请大家吃饭?/span>");

l果出来的是Q?/div>
boss: 大家h意了Q我请大家吃饭?/span>

通过上面发现Q这U代理比较呆板,比如_Boss口了,又得重新写一个代理方法,q个时候,可以使用动态代理来q行Q?/div>

d一个接口IBoss
1 public interface IBoss {
2     public void anounce(String content);
3     public void drink();
4 }

修改Boss
1 public class Boss implements IBoss {
2     public void anounce(String content) {
3         System.out.println(content);
4     }
5 
6     public void drink() {
7         System.out.println("boss: 拿v杯子Q喝?/span>");
8     }
9 }

q时U书MM变ؓ
 1 import java.lang.reflect.InvocationHandler;
 2 import java.lang.reflect.Method;
 3 
 4 public class MMProxy implements InvocationHandler {
 5 
 6     private Object obj;
 7 
 8     public MMProxy(Object obj) {
 9         this.obj = obj;
10     }
11 
12     public static Object newInstance(Object obj) {
13         return java.lang.reflect.Proxy.newProxyInstance(
14             obj.getClass().getClassLoader(),
15             obj.getClass().getInterfaces(),
16             new MMProxy(obj));
17     }
18     
19     @Override
20     public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
21         if("drink".equals(method.getName())) {
22             System.out.println("U书MM: 看到boss惛_水了Q于?nbsp;把水倒进boss的杯子里?/span>");
23         } else if("anounce".equals(method.getName())) {
24             System.out.print("boss: 大家h意!");
25         }
26         method.invoke(obj, args);
27         return null;
28     }
29 }

        IBoss boss = (IBoss) MMProxy.newInstance(new Boss());
        boss.anounce(
"我请大家吃饭?/span>");
        boss.drink();

boss: 大家h意!我请大家吃饭?/span>
U书MM: 看到boss惛_水了Q于?把水倒进boss的杯子里?/span>
boss: 拿v杯子Q喝?br />
现在发现了吧Q秘书MM真是服务周到呀?/div>


leisure 2011-12-09 09:54 发表评论
]]>反射判断成员变量是否静态,q获得其静态成员的?/title><link>http://www.aygfsteel.com/leisure/archive/2011/11/23/364648.html</link><dc:creator>leisure</dc:creator><author>leisure</author><pubDate>Wed, 23 Nov 2011 09:06:00 GMT</pubDate><guid>http://www.aygfsteel.com/leisure/archive/2011/11/23/364648.html</guid><wfw:comment>http://www.aygfsteel.com/leisure/comments/364648.html</wfw:comment><comments>http://www.aygfsteel.com/leisure/archive/2011/11/23/364648.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/leisure/comments/commentRss/364648.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/leisure/services/trackbacks/364648.html</trackback:ping><description><![CDATA[<div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">        Field[] fields </span><span style="color: #000000; ">=</span><span style="color: #000000; "> cls.getDeclaredFields();<br />        Field field </span><span style="color: #000000; ">=</span><span style="color: #000000; "> fields[</span><span style="color: #000000; ">0</span><span style="color: #000000; ">];<br />        </span><span style="color: #0000FF; ">boolean</span><span style="color: #000000; "> isStatic </span><span style="color: #000000; ">=</span><span style="color: #000000; "> Modifier.isStatic(field.getModifiers());<br />        if(isStatic) {<br />            System.out.println(</span><span style="color: red; ">field.get(null).toString()</span><span style="color: #000000; ">);<br />        }</span></div><img src ="http://www.aygfsteel.com/leisure/aggbug/364648.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/leisure/" target="_blank">leisure</a> 2011-11-23 17:06 <a href="http://www.aygfsteel.com/leisure/archive/2011/11/23/364648.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SimpleDateFormat多线Eƈ发下的不安全隐患http://www.aygfsteel.com/leisure/archive/2011/10/15/361165.htmlleisureleisureFri, 14 Oct 2011 16:22:00 GMThttp://www.aygfsteel.com/leisure/archive/2011/10/15/361165.htmlhttp://www.aygfsteel.com/leisure/comments/361165.htmlhttp://www.aygfsteel.com/leisure/archive/2011/10/15/361165.html#Feedback0http://www.aygfsteel.com/leisure/comments/commentRss/361165.htmlhttp://www.aygfsteel.com/leisure/services/trackbacks/361165.html

最q偶然发C些数据的日期有错乱,而且旉出错格式无规律,有些M1970q了Q有些月份错了,有些h变了Q而日志上看ƈ没有异常信息Q?/span>

Ҏ用户反应Q常出现在某个批量更新操作中Q于是乎Q也按照用户描述的,U下操作了数遍,也没有出现这U情c?/span>

有趣的是Q就在U上操作Q也q不是一定会出现q种问题Q只是偶Ӟ

我开始怀疑底层代码问题了Q因为那个操作,q没有修改到日期相关的字D,Z证实q点Q经q我一番的排查Q?br />问题l于定位在DateUtil.parse{方法上QparseҎ调用了一个静态的simpleDateFormat.parseҎQؓ什么?Qؓ什么这个方法不E_的?
仔细阅读了java.util.SimpleDateFormat的apiQ发现此信息Q?/span>

Synchronization

Date formats are not synchronized. It is recommended to create separate format instances for each thread.
If multiple threads access a format concurrently, it must be synchronized externally.


很明显simpledateformatq不是线E同步的Q以致ƈ发的时候不安全Qؓ了证实这点于是乎写了一个简单的试E序?br />

package com.leisure;
import java.text.ParseException;
public class TestSimpleDateFormatThreadSafe extends Thread {
    @Override
    public void run() {
        while(true) {
            try {
                this.join(2000);
            } 
catch (InterruptedException e1) {
                e1.printStackTrace();
            }
            try {
                System.out.println(DateUtil.parse(
"2011-10-11 06:02:20"));
            } 
catch (ParseException e) {
                e.printStackTrace();
            }
        }
    }

    public static void main(String[] args) {
        for(int i = 0; i < 20; i++)
            new TestSimpleDateFormatThreadSafe().start();
    }
}

package com.leisure;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
    
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    
public static Date parse(String str) throws ParseException {
        
return sdf.parse(str);
    }
}

输出l果Q?

Tue Oct 11 18:02:20 CST 2011

Tue Oct 11 18:02:20 CST 2011

Sun Oct 11 18:02:20 CST 1970

Tue Oct 11 18:02:20 CST 2011

Thu Jan 01 18:02:20 CST 1970

Sat Dec 11 18:02:20 CST 2010

Tue Oct 11 18:02:20 CST 2011

Exception in thread "Thread-18" java.lang.NumberFormatException: multiple points

at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)

at java.lang.Double.parseDouble(Unknown Source)

at java.text.DigitList.getDouble(Unknown Source)

at java.text.DecimalFormat.parse(Unknown Source)

at java.text.SimpleDateFormat.subParse(Unknown Source)

at java.text.SimpleDateFormat.parse(Unknown Source)

at java.text.DateFormat.parse(Unknown Source)

at com.leisure.DateUtil.parse(DateUtil.java:12)

at com.leisure.TestSimpleDateFormatThreadSafe.run(TestSimpleDateFormatThreadSafe.java:16)

Fri Dec 23 19:02:20 CST 2011

Fri Dec 23 18:02:20 CST 2011

输出l果很明显了Q跟U上数据出现的问题基本一致。不q按照这里看到的l果Q有报错Q再仔细阅读了应用的底层代码Q?br />某个位置拦截了部份异常,没有记录也没有向上抛出处理,到这里,我只想问一句:底层代码谁写的?



leisure 2011-10-15 00:22 发表评论
]]>jstl创徏map和对map赋?/title><link>http://www.aygfsteel.com/leisure/archive/2011/10/12/360936.html</link><dc:creator>leisure</dc:creator><author>leisure</author><pubDate>Wed, 12 Oct 2011 00:46:00 GMT</pubDate><guid>http://www.aygfsteel.com/leisure/archive/2011/10/12/360936.html</guid><wfw:comment>http://www.aygfsteel.com/leisure/comments/360936.html</wfw:comment><comments>http://www.aygfsteel.com/leisure/archive/2011/10/12/360936.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/leisure/comments/commentRss/360936.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/leisure/services/trackbacks/360936.html</trackback:ping><description><![CDATA[<div><div>jstl本n是没有语法技持创建对象的Q不q我们可以用jsp:useBean标签来创建,然后使用c:set标签来赋?/div><div></div><div>应的倹{?/div><div></div><div><div><div><jsp:useBean id="map" class="java.util.HashMap" scope="request"></div><div><span style="white-space: pre; "> </span><c:set target="${map}" property="a" value="b" /></div><div></jsp:useBean></div><div>${map}</div></div></div><div></div><div>另外c:remove可以U除相应的属性?/div><div>更多jstl请参?a target="_blank">http://java.sun.com/products/jsp/jstl/reference/api/index.html</a></div></div><div></div><img src ="http://www.aygfsteel.com/leisure/aggbug/360936.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/leisure/" target="_blank">leisure</a> 2011-10-12 08:46 <a href="http://www.aygfsteel.com/leisure/archive/2011/10/12/360936.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>eclipsedgit功能http://www.aygfsteel.com/leisure/archive/2011/10/11/360931.htmlleisureleisureTue, 11 Oct 2011 01:36:00 GMThttp://www.aygfsteel.com/leisure/archive/2011/10/11/360931.htmlhttp://www.aygfsteel.com/leisure/comments/360931.htmlhttp://www.aygfsteel.com/leisure/archive/2011/10/11/360931.html#Feedback0http://www.aygfsteel.com/leisure/comments/commentRss/360931.htmlhttp://www.aygfsteel.com/leisure/services/trackbacks/360931.html
Git是一个开源的分布式版本控制系l,提供了非常快捷和强大的项目版本管理功能?/div>
EGit目是一个基于Eclipse插g开发的Q很大程度上方便了我们Eclipse一族?/div>
Help-->Install New Software-->Add
Egit
http://download.eclipse.org/egit/updates/ 
注意egit对应eclipse的版本~
然后按默认操作,待确认重启即完成安装Q?/div>
详情Q?nbsp;EGit官方|站


leisure 2011-10-11 09:36 发表评论
]]>推荐几本E序员必ȝ书籍http://www.aygfsteel.com/leisure/archive/2011/10/05/360021.htmlleisureleisureTue, 04 Oct 2011 16:42:00 GMThttp://www.aygfsteel.com/leisure/archive/2011/10/05/360021.htmlhttp://www.aygfsteel.com/leisure/comments/360021.htmlhttp://www.aygfsteel.com/leisure/archive/2011/10/05/360021.html#Feedback0http://www.aygfsteel.com/leisure/comments/commentRss/360021.htmlhttp://www.aygfsteel.com/leisure/services/trackbacks/360021.html阅读全文

leisure 2011-10-05 00:42 发表评论
]]>
using dom4j to handle xml 使用dom4j操作xmlhttp://www.aygfsteel.com/leisure/archive/2011/09/20/358715.htmlleisureleisureMon, 19 Sep 2011 16:16:00 GMThttp://www.aygfsteel.com/leisure/archive/2011/09/20/358715.htmlhttp://www.aygfsteel.com/leisure/comments/358715.htmlhttp://www.aygfsteel.com/leisure/archive/2011/09/20/358715.html#Feedback0http://www.aygfsteel.com/leisure/comments/commentRss/358715.htmlhttp://www.aygfsteel.com/leisure/services/trackbacks/358715.html以一个xmlZQ分别展C出dom4j操作xml的常用操?dQ查找节点,U除Q输?.. ...  阅读全文

leisure 2011-09-20 00:16 发表评论
]]>
java自动获取安装在线数字证书http://www.aygfsteel.com/leisure/archive/2011/09/18/358655.htmlleisureleisureSun, 18 Sep 2011 15:36:00 GMThttp://www.aygfsteel.com/leisure/archive/2011/09/18/358655.htmlhttp://www.aygfsteel.com/leisure/comments/358655.htmlhttp://www.aygfsteel.com/leisure/archive/2011/09/18/358655.html#Feedback0http://www.aygfsteel.com/leisure/comments/commentRss/358655.htmlhttp://www.aygfsteel.com/leisure/services/trackbacks/358655.html
以前写过q个工具cMQhttp://leisuredev.iteye.com/admin/blogs/714742
今天E微注释q整理了一个版本:  阅读全文

leisure 2011-09-18 23:36 发表评论
]]>
Java安装本地证书http://www.aygfsteel.com/leisure/archive/2011/09/17/358877.htmlleisureleisureSat, 17 Sep 2011 13:13:00 GMThttp://www.aygfsteel.com/leisure/archive/2011/09/17/358877.htmlhttp://www.aygfsteel.com/leisure/comments/358877.htmlhttp://www.aygfsteel.com/leisure/archive/2011/09/17/358877.html#Feedback1http://www.aygfsteel.com/leisure/comments/commentRss/358877.htmlhttp://www.aygfsteel.com/leisure/services/trackbacks/358877.htmlkeytool是Java的数字证书管理工P位于%JAVA_HOME%\bin目录下,keytool可以密钥(keyQ和证书QcertificatesQ存在一个称为keystore的文件中?

D:\>keytool -import -file d:\google.cer -keystore d:\google.keystore
输入keystore密码Q?
再次输入新密?
所有?CN=www.google.com, O=Google Inc, L=Mountain View, ST=California, C=US
{֏?CN=Thawte SGC CA, O=Thawte Consulting (Pty) Ltd., C=ZA  阅读全文

leisure 2011-09-17 21:13 发表评论
]]>
վ֩ģ壺 | | | | | ²| | | | | ˮ| | | ³| | | | ٳ| | | ɽ| ֳ| ɽ| ƺ| | | Զ| Ԫ| | Ӫ| ˶| | | | Ƹ| ԰| | | | | |