ÿ¸öÏîÄ¿ÖУ¬Äã²»µÃ²»ÖªµÄ11¸öJavaµÚÈý·½Àà¿â
µ¥Ôª²âÊÔ
1.
DBUnit
DBunitÊÇÒ»¸ö»ùÓÚjunitÀ©Õ¹µÄÊý¾Ý¿â²âÊÔ¿ò¼Ü¡£ËüÌṩÁË´óÁ¿µÄÀà¶ÔÓëÊý¾Ý¿âÏà¹ØµÄ²Ù×÷½øÐÐÁ˳éÏóºÍ·â×°¡£
2.MOckito
MockitoÊÇÒ»¸öÕë¶ÔJavaµÄmocking¿ò¼Ü¡£Äã¿ÉÒÔʹÓüò½àµÄAPI±àд³öƯÁÁµÄ²âÊÔ¡£
3.Hamcrest Matchers
Hamcrest ÊÇÒ»¸ö²âÊÔ¸¨Öú¹¤¾ß£¬ÌṩÁËÒ»Ì×ͨÓõÄÆ¥Åä·û Matcher£¬Áé»îʹÓÃÕâЩƥÅä·û¶¨ÒåµÄ¹æÔò£¬³ÌÐòÔ±¿ÉÒÔ¸ü¼Ó¾«È·µÄ±í´ï×Ô¼ºµÄ²âÊÔ˼Ï룬ָ¶¨ËùÏëÉ趨µÄ²âÊÔÌõ¼þ¡£
Junit4½áºÏHamcrestÌṩÁËеĶÏÑÔÓï¾ä-assertThat£¬Ö»ÐèÒ»¸öassertThatÓï¾ä£¬½áºÏHamcrestÌṩµÄÆ¥Åä·û£¬¾Í¿ÉÒÔ±í´ïÈ«²¿µÄ²âÊÔ˼Ïë¡£
Apache Commons
4.Configuration
Õâ¸ö¹¤¾ßÊÇÓÃÀ´°ïÖú´¦ÀíÅäÖÃÎļþµÄ£¬Ö§³ÖºÜ¶àÖÖ´æ´¢·½Ê½
5.DbUtils
DbUtils¿ÉÒÔ½«Êý¾Ý¿â²Ù×÷µ¥¶À×ö³ÉÒ»¸ö°ü£¬¼ò»¯Êý¾Ý¿â²Ù×÷¡£
6.IO
¿ÉÒÔ¿´³ÉÊÇjava.ioµÄÀ©Õ¹¡£ËüÌṩÁËÎļþÔĶÁ¹¦ÄÜ£¬ÒÔ¼°Ò»Ð©Ê¹Óõķ½·¨£¬ÀàËÆÓÚDbUtils¡£
7.Lang
Èç¹ûÄãÒªÎÊÎÒ»¹ÓÐÄĸö¿âÒ»»áÔÚ´ËÃûµ¥Ö®ÉÏ£¬ÎÒ»á¸æËßÄãÊÇLang»òÕßgoogle
Collections¡£lang¿ÉÒÔ¿´³ÉÊǶÔjava.langµÄÀ©Õ¹£¬ÌṩÁËÖîÈçStringUtils, StringEscapeUtils,
RandomStringUtils, Tokenizer, WordUtilsµÈ¹¤¾ßÀà¡£
ºóÆðÖ®Ðã
8.SLF4J
SLF4JÊÇΪ¸÷ÖÖloging APIsÌṩһ¸ö¼òµ¥Í³Ò»µÄ½Ó¿Ú£¬´Ó¶øʹµÃ×îÖÕÓû§Äܹ»ÔÚ²¿ÊðµÄʱºòÅäÖÃ×Ô¼ºÏ£ÍûµÄloging APIsʵÏÖ¡£Slf4jÀàËÆÓÚApache Common-LoggingºÍLog4J£¬µ«Slf4j±ÈËüÃǶ¼ÒªÓÅÐã¡£
9.Google Collections
JavaµÄ¼¯ºÏ¿ò¼ÜÊÇJavaÀà¿âµ±ÖÐʹÓÃƵÂÊ×î¸ßµÄ²¿·ÖÖ®Ò»£¬¶øGoogle Collections¿âÊÇÓÉGoogle»ùÓÚJava5.0 Collections Framework¿ª·¢µÄÒ»Ì×еÄJava¼¯ºÏ¿ò¼Ü£¬ÌṩһЩ¸ß¼¶¼¯ºÏ²Ù×÷µÄAPI¡£
10.c3p0
C3P0ÊÇÒ»¸öËæHibernateһͬ·Ö·¢µÄ¿ªÔ´µÄJDBCÁ¬½Ó³Ø£¬ ËüλÓÚlibĿ¼Ï¡£ °üÀ¨ÁËʵÏÖjdbc3ºÍjdbc2À©Õ¹¹æ·¶ËµÃ÷µÄConnection ºÍStatement ³ØµÄDataSources ¶ÔÏó¡£
11.Joda Time
Joda TimeÊÇÒ»¸öÇ¿´óÒ×ÓõÄÈÕÆÚºÍʱ¼ä¿â£¬¿ÉÒÔÍêÈ«È¡´úJDKDateºÍCalendarÀà¡£
Ïà¹ØÎĵµ£º
1¡¢JavaÐÞÊηû Java ·ÃÎÊȨÏÞ\
Àà³ÉÔ±±äÁ¿¡¢º¯ÊýÐÞÊηû ±¾Àà Î޼̳йØϵ
ͬһ°ü Î޼̳йØϵ
²»Í¬°ü ¼Ì³Ð¹Øϵ£¨×ÓÀࣩ
ͬһ°ü ¼Ì ......
package com.tienway.util;
import java.util.ArrayList;
public class StringUtil
{
public static String ContextType1ToType2(String Type1Context)
{
if (Type1Context== null || Type1Context.length() == 0)
{
return "";
}
char[] c = Type1Con ......
JAVAÀà×°ÔØÆ÷classloaderºÍÃüÃû¿Õ¼änamespace
JAVAÐéÄâ»úͨ¹ý×°ÔØ¡¢Á¬½ÓºÍ³õʼ»¯Ò»¸öJAVAÀàÐÍ£¬Ê¹¸ÃÀàÐÍ¿ÉÒÔ±»ÕýÔÚÔËÐеÄJAVA³ÌÐòËùʹÓá£ÆäÖУ¬×°ÔؾÍÊǰѶþ½øÖÆÐÎʽµÄJAVAÀàÐͶÁÈëJAVAÐéÄâ»úÖС£Á¬½Ó¾ÍÊÇ°ÑÕâÖÖÒѾ¶ÁÈëÐéÄâ»úµÄ¶þ½øÖÆÐÎʽµÄÀàÐÍÊý¾ÝºÏ²¢µ½ÐéÄâ»úµÄÔËÐÐʱ״̬ÖÐÈ¥¡£Á¬½Ó½×¶Î·ÖΪÈý¸ö²½Öè£ÑéÖ¤¡¢× ......
¾³£Íü¼ÇÕâЩ»ù´¡µÄ¶«Î÷£¬¼ÇÏÂÀ´ÁË¡£
ÔÚjspºÍclassÎļþÖе÷ÓõÄÏà¶Ô·¾¶²»Í¬¡£ ÔÚjspÀ¸ùĿ¼ÊÇWebRoot ÔÚclassÎļþÖУ¬¸ùĿ¼ÊÇWebRoot/WEB-INF/classes µ±È»ÄãÒ²¿ÉÒÔÓÃSystem.getProperty("user.dir")»ñÈ¡Ä㹤³ÌµÄ¾ø¶Ô·¾¶¡£
Áí:ÔÚJsp,Servlet,JavaÖÐÏêϸ»ñµÃ·¾¶µÄ·½·¨!
1.jspÖÐÈ¡µÃ·¾¶£º
ÒÔ¹¤³ÌÃûΪTESTΪÀý£º
......
×÷Õß
Josh Long
ÒëÕß
ËÎçâ
·¢²¼ÓÚ
2010Äê5ÔÂ5ÈÕ ÏÂÎç9ʱ7·Ö
Josh BlochÔÚSun¹«Ë¾¶àÄêΪJavaƽ̨×÷³öÁ˽ܳö¹±Ï×£¨Èç¹ûÄãÓùýJava
Collections¿ò¼Ü¾Í»áÁ˽âÕâÒ»µã£©£¬ÏÖÔÚGoogle¾ÍÖ°£¬ÊÇ»ñ½±Í¼Ê顶Effective ......