﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-一辈子的事情不爱怎么行</title><link>http://www.blogjava.net/b1412/</link><description /><language>zh-cn</language><lastBuildDate>Sun, 12 Apr 2026 16:43:57 GMT</lastBuildDate><pubDate>Sun, 12 Apr 2026 16:43:57 GMT</pubDate><ttl>60</ttl><item><title>[链接]JVM知识库</title><link>http://www.blogjava.net/b1412/archive/2012/07/08/382509.html</link><dc:creator>周磊</dc:creator><author>周磊</author><pubDate>Sun, 08 Jul 2012 02:17:00 GMT</pubDate><guid>http://www.blogjava.net/b1412/archive/2012/07/08/382509.html</guid><wfw:comment>http://www.blogjava.net/b1412/comments/382509.html</wfw:comment><comments>http://www.blogjava.net/b1412/archive/2012/07/08/382509.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/b1412/comments/commentRss/382509.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/b1412/services/trackbacks/382509.html</trackback:ping><description><![CDATA[<a href="http://hllvm.group.iteye.com/group/wiki?category_id=316">http://hllvm.group.iteye.com/group/wiki?category_id=316</a>&nbsp;<img src ="http://www.blogjava.net/b1412/aggbug/382509.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/b1412/" target="_blank">周磊</a> 2012-07-08 10:17 <a href="http://www.blogjava.net/b1412/archive/2012/07/08/382509.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>近期阅读计划 </title><link>http://www.blogjava.net/b1412/archive/2012/06/29/381834.html</link><dc:creator>周磊</dc:creator><author>周磊</author><pubDate>Fri, 29 Jun 2012 07:07:00 GMT</pubDate><guid>http://www.blogjava.net/b1412/archive/2012/06/29/381834.html</guid><wfw:comment>http://www.blogjava.net/b1412/comments/381834.html</wfw:comment><comments>http://www.blogjava.net/b1412/archive/2012/06/29/381834.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/b1412/comments/commentRss/381834.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/b1412/services/trackbacks/381834.html</trackback:ping><description><![CDATA[再看看&lt;effective java&gt; ，对前半年写的代码进行一下反思<br />慢慢看《Hadoop实战中文版》，了解分布式系统<br />认真阅读《设计模式之禅》，加深对自己已经在实际项目中运用的模式的理解。<br />阅读《java解惑》的后半部分（2年前读过前几十条建议），了解编码中的陷阱。<img src ="http://www.blogjava.net/b1412/aggbug/381834.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/b1412/" target="_blank">周磊</a> 2012-06-29 15:07 <a href="http://www.blogjava.net/b1412/archive/2012/06/29/381834.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【收集】Java8</title><link>http://www.blogjava.net/b1412/archive/2012/06/27/381592.html</link><dc:creator>周磊</dc:creator><author>周磊</author><pubDate>Wed, 27 Jun 2012 03:47:00 GMT</pubDate><guid>http://www.blogjava.net/b1412/archive/2012/06/27/381592.html</guid><wfw:comment>http://www.blogjava.net/b1412/comments/381592.html</wfw:comment><comments>http://www.blogjava.net/b1412/archive/2012/06/27/381592.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/b1412/comments/commentRss/381592.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/b1412/services/trackbacks/381592.html</trackback:ping><description><![CDATA[<h1 style="font-size: x-large; font-family: 'Bitstream Vera Sans', Verdana, 'sans serif'; line-height: normal; ">State of the Lambda</h1><a href="http://cr.openjdk.java.net/~briangoetz/lambda/lambda-state-4.html">http://cr.openjdk.java.net/~briangoetz/lambda/lambda-state-4.html</a>&nbsp;<br /><br />jdk快点出吧lambdba把，一直用op4j和lambdbaj这些jar包很蛋疼。。<br /><img src ="http://www.blogjava.net/b1412/aggbug/381592.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/b1412/" target="_blank">周磊</a> 2012-06-27 11:47 <a href="http://www.blogjava.net/b1412/archive/2012/06/27/381592.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> Connection is read-only. Queries leading to data modification are not allowed</title><link>http://www.blogjava.net/b1412/archive/2012/05/24/378999.html</link><dc:creator>周磊</dc:creator><author>周磊</author><pubDate>Thu, 24 May 2012 01:59:00 GMT</pubDate><guid>http://www.blogjava.net/b1412/archive/2012/05/24/378999.html</guid><wfw:comment>http://www.blogjava.net/b1412/comments/378999.html</wfw:comment><comments>http://www.blogjava.net/b1412/archive/2012/05/24/378999.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/b1412/comments/commentRss/378999.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/b1412/services/trackbacks/378999.html</trackback:ping><description><![CDATA[<div>spring配置该方法只读了。<br /><br /><div><div>&lt;bean id="txProxyTemplate" abstract="true"</div><div>&nbsp; &nbsp; &nbsp; &nbsp;class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;property name="transactionManager" ref="transactionManager"/&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;property name="transactionAttributes"&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;props&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="white-space:pre">	</span> &nbsp; &lt;prop key="affirm*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="white-space:pre">	</span> &nbsp; &lt;prop key="gen*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;prop key="save*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;prop key="update*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;prop key="create*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;prop key="process*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;prop key="delete*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;prop key="remove*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;prop key="send*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt;</div><div><span style="white-space:pre">			</span> &nbsp; &lt;prop key="upload*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;prop key="*"&gt;PROPAGATION_REQUIRED,readOnly&lt;/prop&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/props&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;/property&gt;&lt;/bean&gt;<br /><br /></div></div></div><img src ="http://www.blogjava.net/b1412/aggbug/378999.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/b1412/" target="_blank">周磊</a> 2012-05-24 09:59 <a href="http://www.blogjava.net/b1412/archive/2012/05/24/378999.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【转】java进制转换</title><link>http://www.blogjava.net/b1412/archive/2012/04/29/377023.html</link><dc:creator>周磊</dc:creator><author>周磊</author><pubDate>Sun, 29 Apr 2012 04:10:00 GMT</pubDate><guid>http://www.blogjava.net/b1412/archive/2012/04/29/377023.html</guid><wfw:comment>http://www.blogjava.net/b1412/comments/377023.html</wfw:comment><comments>http://www.blogjava.net/b1412/archive/2012/04/29/377023.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/b1412/comments/commentRss/377023.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/b1412/services/trackbacks/377023.html</trackback:ping><description><![CDATA[<div><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">十进制转成十六进制：&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">Integer.toHexString(int i)&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">十进制转成八进制&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">Integer.toOctalString(int i)&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">十进制转成二进制&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">Integer.toBinaryString(int i)&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">十六进制转成十进制&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">Integer.valueOf("FFFF",16).toString()&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">八进制转成十进制&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">Integer.valueOf("876",8).toString()&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">二进制转十进制&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">Integer.valueOf("0101",2).toString()&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">有什么方法可以直接将2,8,16进制直接转换为10进制的吗?&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">java.lang.Integer类&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">parseInt(String s, int radix)&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">使用第二个参数指定的基数，将字符串参数解析为有符号的整数。&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">examples from jdk:&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">parseInt("0", 10) returns 0&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">parseInt("473", 10) returns 473&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">parseInt("-0", 10) returns 0&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">parseInt("-FF", 16) returns -255&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">parseInt("1100110", 2) returns 102&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">parseInt("2147483647", 10) returns 2147483647&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">parseInt("-2147483648", 10) returns -2147483648&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">parseInt("2147483648", 10) throws a NumberFormatException&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">parseInt("99",</span><img src="http://yelanglee.javaeye.com/images/smiles/icon_cool.gif" _counted="undefined" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; max-width: 650px; font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; "  alt="" /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;throws a NumberFormatException&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">parseInt("Kona", 10) throws a NumberFormatException&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">parseInt("Kona", 27) returns 411787&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">进制转换如何写（二，八，十六）不用算法&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">Integer.toBinaryString&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">Integer.toOctalString&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">Integer.toHexString&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">例二&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">public class Test{&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp; public static void main(String args[]){&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; int i=100;&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; String binStr=Integer.toBinaryString(i);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; String otcStr=Integer.toOctalString(i);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; String hexStr=Integer.toHexString(i);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; System.out.println(binStr);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">}&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">例二&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">public class TestStringFormat {&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp; public static void main(String[] args) {&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; if (args.length == 0) {&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("usage: java TestStringFormat &lt;a number&gt;");&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.exit(0);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; }&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; Integer factor = Integer.valueOf(args[0]);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; String s;&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; s = String.format("%d", factor);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; System.out.println(s);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; s = String.format("%x", factor);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; System.out.println(s);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; s = String.format("%o", factor);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp;&nbsp; System.out.println(s);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">&nbsp;&nbsp; }&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">}&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">其他方法：&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">Integer.toHexString(你的10进制数);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">例如&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">String temp = Integer.toHexString(75);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">输出temp就为 4b&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">//输入一个10进制数字并把它转换成16进制&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">import java.io.*;&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">public class toHex{&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">public static void main(String[]args){&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">int input;//存放输入数据&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">//创建输入字符串的实例&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">BufferedReader strin=new BufferedReader(new InputStreamReader(System.in));&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">System.out.println("请输入一个的整数：");&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">String x=null;&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">try{&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">x=strin.readLine();&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">}catch(IOException ex){&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">ex.printStackTrace();&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">}&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">input=Integer.parseInt(x);&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">System.out.println ("你输入的数字是："+input);//输出从键盘接收到的数字&nbsp;</span><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><br style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; " /><span style="font-family: 宋体, Arial; font-size: 12px; line-height: 18px; background-color: #f5f7f8; ">System.out.println ("它的16进制是："+Integer.toHexString(input));//用toHexString把10进制转换成16进制&nbsp;</span></div><img src ="http://www.blogjava.net/b1412/aggbug/377023.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/b1412/" target="_blank">周磊</a> 2012-04-29 12:10 <a href="http://www.blogjava.net/b1412/archive/2012/04/29/377023.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]利用jrebel实现Tomcat的热加载</title><link>http://www.blogjava.net/b1412/archive/2012/03/26/372713.html</link><dc:creator>周磊</dc:creator><author>周磊</author><pubDate>Mon, 26 Mar 2012 07:27:00 GMT</pubDate><guid>http://www.blogjava.net/b1412/archive/2012/03/26/372713.html</guid><wfw:comment>http://www.blogjava.net/b1412/comments/372713.html</wfw:comment><comments>http://www.blogjava.net/b1412/archive/2012/03/26/372713.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/b1412/comments/commentRss/372713.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/b1412/services/trackbacks/372713.html</trackback:ping><description><![CDATA[<div><a href="http://linbin007.iteye.com/blog/809759">http://linbin007.iteye.com/blog/809759<br /><div><div></div><div>-noverify&nbsp;</div><div>-javaagent:D:/jrebel.jar</div><div>-Drebel.dirs=E:\workspace\WantWant\webapp\WEB-INF\classes</div></div></a></div><img src ="http://www.blogjava.net/b1412/aggbug/372713.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/b1412/" target="_blank">周磊</a> 2012-03-26 15:27 <a href="http://www.blogjava.net/b1412/archive/2012/03/26/372713.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>javassist.NotFoundException </title><link>http://www.blogjava.net/b1412/archive/2012/03/22/372465.html</link><dc:creator>周磊</dc:creator><author>周磊</author><pubDate>Thu, 22 Mar 2012 07:22:00 GMT</pubDate><guid>http://www.blogjava.net/b1412/archive/2012/03/22/372465.html</guid><wfw:comment>http://www.blogjava.net/b1412/comments/372465.html</wfw:comment><comments>http://www.blogjava.net/b1412/archive/2012/03/22/372465.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/b1412/comments/commentRss/372465.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/b1412/services/trackbacks/372465.html</trackback:ping><description><![CDATA[<div><h4>Class search path</h4><p style="font-family: Simsun; line-height: normal; font-size: medium; ">The default&nbsp;<code>ClassPool</code>&nbsp;returned by a static method&nbsp;<code>ClassPool.getDefault()</code>&nbsp;searches the same path that the underlying JVM (Java virtual machine) has.&nbsp;<em style="color: #cc0000; ">If a program is running on a web application server such as JBoss and Tomcat, the&nbsp;<code>ClassPool</code>&nbsp;object may not be able to find user classes</em>&nbsp;since such a web application server uses multiple class loaders as well as the system class loader. In that case, an additional class path must be registered to the&nbsp;<code>ClassPool</code>. Suppose that&nbsp;<code>pool</code>&nbsp;refers to a<code>ClassPool</code>&nbsp;object:</p><ul style="font-family: Simsun; line-height: normal; font-size: medium; "><pre>pool.insertClassPath(new ClassClassPath(this.getClass())); </pre></ul><p style="font-family: Simsun; line-height: normal; font-size: medium; ">This statement registers the class path that was used for loading the class of the object that&nbsp;<code>this</code>&nbsp;refers to. You can use any&nbsp;<code>Class</code>&nbsp;object as an argument instead of<code>this.getClass()</code>. The class path used for loading the class represented by that&nbsp;<code>Class</code>&nbsp;object is registered.</p><p style="font-family: Simsun; line-height: normal; font-size: medium; ">You can register a directory name as the class search path. For example, the following code adds a directory&nbsp;<code>/usr/local/javalib</code>&nbsp;to the search path:</p><ul style="font-family: Simsun; line-height: normal; font-size: medium; "><pre>ClassPool pool = ClassPool.getDefault(); pool.insertClassPath("/usr/local/javalib"); </pre></ul><p style="font-family: Simsun; line-height: normal; font-size: medium; ">The search path that the users can add is not only a directory but also a URL:</p><ul style="font-family: Simsun; line-height: normal; font-size: medium; "><pre>ClassPool pool = ClassPool.getDefault(); ClassPath cp = new URLClassPath("www.javassist.org", 80, "/java/", "org.javassist."); pool.insertClassPath(cp); </pre></ul><p style="font-family: Simsun; line-height: normal; font-size: medium; ">This program adds "http://www.javassist.org:80/java/" to the class search path. This URL is used only for searching classes belonging to a package&nbsp;<code>org.javassist</code>. For example, to load a class&nbsp;<code>org.javassist.test.Main</code>, its class file will be obtained from:</p><ul style="font-family: Simsun; line-height: normal; font-size: medium; "><pre>http://www.javassist.org:80/java/org/javassist/test/Main.class </pre></ul><p style="font-family: Simsun; line-height: normal; font-size: medium; ">Furthermore, you can directly give a byte array to a&nbsp;<code>ClassPool</code>&nbsp;object and construct a&nbsp;<code>CtClass</code>&nbsp;object from that array. To do this, use&nbsp;<code>ByteArrayClassPath</code>. For example,</p><ul style="font-family: Simsun; line-height: normal; font-size: medium; "><pre>ClassPool cp = ClassPool.getDefault(); byte[] b = <em style="color: #cc0000; ">a byte array</em>; String name = <em style="color: #cc0000; ">class name</em>; cp.insertClassPath(new ByteArrayClassPath(name, b)); CtClass cc = cp.get(name); </pre></ul><p style="font-family: Simsun; line-height: normal; font-size: medium; ">The obtained&nbsp;<code>CtClass</code>&nbsp;object represents a class defined by the class file specified by&nbsp;<code>b</code>. The&nbsp;<code>ClassPool</code>&nbsp;reads a class file from the given&nbsp;<code>ByteArrayClassPath</code>&nbsp;if&nbsp;<code>get()</code>&nbsp;is called and the class name given to&nbsp;<code>get()</code>&nbsp;is equal to one specified by&nbsp;<code>name</code>.</p><p style="font-family: Simsun; line-height: normal; font-size: medium; ">If you do not know the fully-qualified name of the class, then you can use&nbsp;<code>makeClass()</code>&nbsp;in&nbsp;<code>ClassPool</code>:</p><ul style="font-family: Simsun; line-height: normal; font-size: medium; "><pre>ClassPool cp = ClassPool.getDefault(); InputStream ins = <em style="color: #cc0000; ">an input stream for reading a class file</em>; CtClass cc = cp.makeClass(ins); </pre></ul><p style="font-family: Simsun; line-height: normal; font-size: medium; "><code>makeClass()</code>&nbsp;returns the&nbsp;<code>CtClass</code>&nbsp;object constructed from the given input stream. You can use&nbsp;<code>makeClass()</code>&nbsp;for eagerly feeding class files to the&nbsp;<code>ClassPool</code>&nbsp;object. This might improve performance if the search path includes a large jar file. Since a&nbsp;<code>ClassPool</code>&nbsp;object reads a class file on demand, it might repeatedly search the whole jar file for every class file.&nbsp;<code>makeClass()</code>&nbsp;can be used for optimizing this search. The&nbsp;<code>CtClass</code>&nbsp;constructed by&nbsp;<code>makeClass()</code>&nbsp;is kept in the&nbsp;<code>ClassPool</code>&nbsp;object and the class file is never read again.</p><p style="font-family: Simsun; line-height: normal; font-size: medium; ">The users can extend the class search path. They can define a new class implementing&nbsp;<code>ClassPath</code>&nbsp;interface and give an instance of that class to&nbsp;<code>insertClassPath()</code>&nbsp;in<code>ClassPool</code>. This allows a non-standard resource to be included in the search path.<br /><br /><br /><br /><br /><br /><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: #0000FF; ">package</span>&nbsp;com.cloud.dm.util;<br /><br /><span style="color: #0000FF; ">import</span>&nbsp;java.io.File;<br /><span style="color: #0000FF; ">import</span>&nbsp;java.lang.reflect.Field;<br /><span style="color: #0000FF; ">import</span>&nbsp;java.net.URL;<br /><span style="color: #0000FF; ">import</span>&nbsp;java.util.ArrayList;<br /><span style="color: #0000FF; ">import</span>&nbsp;java.util.List;<br /><br /><span style="color: #0000FF; ">import</span>&nbsp;javassist.ClassClassPath;<br /><span style="color: #0000FF; ">import</span>&nbsp;javassist.ClassPool;<br /><span style="color: #0000FF; ">import</span>&nbsp;javassist.CtClass;<br /><span style="color: #0000FF; ">import</span>&nbsp;javassist.CtMethod;<br /><span style="color: #0000FF; ">import</span>&nbsp;javassist.CtNewMethod;<br /><span style="color: #0000FF; ">import</span>&nbsp;javassist.bytecode.DuplicateMemberException;<br /><br /><span style="color: #0000FF; ">import</span>&nbsp;org.apache.commons.lang3.StringUtils;<br /><br /><span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">class</span>&nbsp;Struts2GetterSetterGen&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">private</span>&nbsp;<span style="color: #0000FF; ">static</span>&nbsp;ClassPool&nbsp;pool&nbsp;=&nbsp;ClassPool.getDefault();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">static</span>&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;init()&nbsp;<span style="color: #0000FF; ">throws</span>&nbsp;Exception&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;URL&nbsp;url&nbsp;=&nbsp;Struts2GetterSetterGen.<span style="color: #0000FF; ">class</span>.getResource("/");<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List&lt;File&gt;&nbsp;resultList&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;ArrayList&lt;File&gt;();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FileSearcher.findFiles(url.getFile(),&nbsp;"*Action.class",&nbsp;resultList);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">for</span>&nbsp;(File&nbsp;object&nbsp;:&nbsp;resultList)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;className&nbsp;=&nbsp;StringUtils.substringBetween(object.toString(),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"classes\\",&nbsp;".class").replaceAll("\\\\",&nbsp;".");<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CtClass&nbsp;ct&nbsp;=&nbsp;<span style="color: #0000FF; ">null</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pool.insertClassPath(<span style="color: #0000FF; ">new</span>&nbsp;ClassClassPath(Class.forName(className)));&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">在servlet容器中启动</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ct&nbsp;=&nbsp;pool.get(className);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field[]&nbsp;fs&nbsp;=&nbsp;Class.forName(className).getDeclaredFields();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">for</span>&nbsp;(Field&nbsp;f&nbsp;:&nbsp;fs)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;genGetter(ct,&nbsp;f);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;genSetter(ct,&nbsp;f);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ct.writeFile(url.getPath());&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;覆盖之前的class文件</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">private</span>&nbsp;<span style="color: #0000FF; ">static</span>&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;genGetter(CtClass&nbsp;ct,&nbsp;Field&nbsp;field)&nbsp;<span style="color: #0000FF; ">throws</span>&nbsp;Exception&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;string&nbsp;=&nbsp;"public&nbsp;"&nbsp;+&nbsp;field.getType().getName()&nbsp;+&nbsp;"&nbsp;get"<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;StringUtils.capitalize(field.getName())&nbsp;+&nbsp;"()&nbsp;{return&nbsp;"<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;field.getName()&nbsp;+&nbsp;";&nbsp;}";<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CtMethod&nbsp;m&nbsp;=&nbsp;CtNewMethod.make(string,&nbsp;ct);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">try</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ct.addMethod(m);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">catch</span>&nbsp;(DuplicateMemberException&nbsp;e)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">private</span>&nbsp;<span style="color: #0000FF; ">static</span>&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;genSetter(CtClass&nbsp;ct,&nbsp;Field&nbsp;field)&nbsp;<span style="color: #0000FF; ">throws</span>&nbsp;Exception&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;string&nbsp;=&nbsp;"public&nbsp;void&nbsp;set"<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;StringUtils.capitalize(field.getName())&nbsp;+&nbsp;"("<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;field.getType().getName()&nbsp;+&nbsp;"&nbsp;"&nbsp;+&nbsp;field.getName()&nbsp;+&nbsp;"){this."<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;field.getName()&nbsp;+&nbsp;"&nbsp;=&nbsp;"&nbsp;+&nbsp;field.getName()&nbsp;+&nbsp;";&nbsp;}";<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CtMethod&nbsp;m&nbsp;=&nbsp;CtNewMethod.make(string,&nbsp;ct);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">try</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ct.addMethod(m);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">catch</span>&nbsp;(DuplicateMemberException&nbsp;e)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}</div><br /><br /></p></div><img src ="http://www.blogjava.net/b1412/aggbug/372465.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/b1412/" target="_blank">周磊</a> 2012-03-22 15:22 <a href="http://www.blogjava.net/b1412/archive/2012/03/22/372465.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【整理收集】spring data jpa</title><link>http://www.blogjava.net/b1412/archive/2012/03/19/372171.html</link><dc:creator>周磊</dc:creator><author>周磊</author><pubDate>Mon, 19 Mar 2012 01:55:00 GMT</pubDate><guid>http://www.blogjava.net/b1412/archive/2012/03/19/372171.html</guid><wfw:comment>http://www.blogjava.net/b1412/comments/372171.html</wfw:comment><comments>http://www.blogjava.net/b1412/archive/2012/03/19/372171.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/b1412/comments/commentRss/372171.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/b1412/services/trackbacks/372171.html</trackback:ping><description><![CDATA[<div><a href="http://www.ibm.com/developerworks/cn/opensource/os-cn-spring-jpa/index.html">http://www.ibm.com/developerworks/cn/opensource/os-cn-spring-jpa/index.html</a></div><img src ="http://www.blogjava.net/b1412/aggbug/372171.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/b1412/" target="_blank">周磊</a> 2012-03-19 09:55 <a href="http://www.blogjava.net/b1412/archive/2012/03/19/372171.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace </title><link>http://www.blogjava.net/b1412/archive/2012/03/15/371945.html</link><dc:creator>周磊</dc:creator><author>周磊</author><pubDate>Thu, 15 Mar 2012 07:21:00 GMT</pubDate><guid>http://www.blogjava.net/b1412/archive/2012/03/15/371945.html</guid><wfw:comment>http://www.blogjava.net/b1412/comments/371945.html</wfw:comment><comments>http://www.blogjava.net/b1412/archive/2012/03/15/371945.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/b1412/comments/commentRss/371945.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/b1412/services/trackbacks/371945.html</trackback:ping><description><![CDATA[<div style="text-align: left;"><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; background-color: #efefef; "><strong><br /></strong></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; background-color: #efefef; ">org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/xxx<br /></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; background-color: #efefef; "><strong><br /></strong></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; background-color: #efefef; "><div><span style="font-size: medium; ">META-INF下需要有这两个文件:spring-handlers及</span><span style="font-size: medium; ">spring-schemas</span></div></p></div><img src ="http://www.blogjava.net/b1412/aggbug/371945.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/b1412/" target="_blank">周磊</a> 2012-03-15 15:21 <a href="http://www.blogjava.net/b1412/archive/2012/03/15/371945.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Collections.sort 为List排序</title><link>http://www.blogjava.net/b1412/archive/2012/03/13/371818.html</link><dc:creator>周磊</dc:creator><author>周磊</author><pubDate>Tue, 13 Mar 2012 10:13:00 GMT</pubDate><guid>http://www.blogjava.net/b1412/archive/2012/03/13/371818.html</guid><wfw:comment>http://www.blogjava.net/b1412/comments/371818.html</wfw:comment><comments>http://www.blogjava.net/b1412/archive/2012/03/13/371818.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/b1412/comments/commentRss/371818.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/b1412/services/trackbacks/371818.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: #008080; ">&nbsp;1</span>&nbsp;<span style="color: #0000FF; ">package</span>&nbsp;com.cloud.dm;<br /><span style="color: #008080; ">&nbsp;2</span>&nbsp;<br /><span style="color: #008080; ">&nbsp;3</span>&nbsp;<span style="color: #0000FF; ">import</span>&nbsp;java.util.Collections;<br /><span style="color: #008080; ">&nbsp;4</span>&nbsp;<span style="color: #0000FF; ">import</span>&nbsp;java.util.Comparator;<br /><span style="color: #008080; ">&nbsp;5</span>&nbsp;<span style="color: #0000FF; ">import</span>&nbsp;java.util.List;<br /><span style="color: #008080; ">&nbsp;6</span>&nbsp;<span style="color: #0000FF; ">import</span>&nbsp;java.util.Map;<br /><span style="color: #008080; ">&nbsp;7</span>&nbsp;<br /><span style="color: #008080; ">&nbsp;8</span>&nbsp;<span style="color: #0000FF; ">import</span>&nbsp;com.google.common.collect.Lists;<br /><span style="color: #008080; ">&nbsp;9</span>&nbsp;<span style="color: #0000FF; ">import</span>&nbsp;com.google.common.collect.Maps;<br /><span style="color: #008080; ">10</span>&nbsp;<br /><span style="color: #008080; ">11</span>&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">class</span>&nbsp;TreeListTest&nbsp;{<br /><span style="color: #008080; ">12</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">static</span>&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;main(String[]&nbsp;args)&nbsp;{<br /><span style="color: #008080; ">13</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;List&lt;Map&lt;String,&nbsp;Object&gt;&gt;&nbsp;list&nbsp;=&nbsp;Lists.newArrayList();<br /><span style="color: #008080; ">14</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Map&lt;String,&nbsp;Object&gt;&nbsp;map&nbsp;=&nbsp;Maps.newHashMap();<br /><span style="color: #008080; ">15</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map.put("key",&nbsp;201101);<br /><span style="color: #008080; ">16</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Map&lt;String,&nbsp;Object&gt;&nbsp;map2&nbsp;=&nbsp;Maps.newHashMap();<br /><span style="color: #008080; ">17</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map2.put("key",&nbsp;200010);<br /><span style="color: #008080; ">18</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Map&lt;String,&nbsp;Object&gt;&nbsp;map3&nbsp;=&nbsp;Maps.newHashMap();<br /><span style="color: #008080; ">19</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map3.put("key",&nbsp;201103);<br /><span style="color: #008080; ">20</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list.add(map);<br /><span style="color: #008080; ">21</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list.add(map2);<br /><span style="color: #008080; ">22</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list.add(map3);<br /><span style="color: #008080; ">23</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(list);<br /><span style="color: #008080; ">24</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Collections.sort(list,&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;Comparator&lt;Map&lt;String,&nbsp;Object&gt;&gt;()&nbsp;{<br /><span style="color: #008080; ">25</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@Override<br /><span style="color: #008080; ">26</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;compare(Map&lt;String,&nbsp;Object&gt;&nbsp;o1,&nbsp;Map&lt;String,&nbsp;Object&gt;&nbsp;o2)&nbsp;{<br /><span style="color: #008080; ">27</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(o1.get("key").toString().compareTo(o2.get("key").toString()));<br /><span style="color: #008080; ">28</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;o1.get("key").toString().compareTo(o2.get("key").toString());<br /><span style="color: #008080; ">29</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><span style="color: #008080; ">30</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});<br /><span style="color: #008080; ">31</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(list);<br /><span style="color: #008080; ">32</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><span style="color: #008080; ">33</span>&nbsp;}<br /><span style="color: #008080; ">34</span>&nbsp;</div><img src ="http://www.blogjava.net/b1412/aggbug/371818.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/b1412/" target="_blank">周磊</a> 2012-03-13 18:13 <a href="http://www.blogjava.net/b1412/archive/2012/03/13/371818.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>