ÿ¸öÏîÄ¿ÖУ¬Äã²»µÃ²»ÖªµÄ11¸öJavaµÚÈý·½Àà¿â
JavaµÚÈý·½library ecosystemÊÇÒ»¸öºÜ¹ãÀ«µÄ·¶³ë¡£²»¾ÃÇ°ÓÐÈË׫ÎÄ£ºÃ¿¸öÏîÄ¿ÖУ¬Äã±ØÐëÖªµÀµÄ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Àà¡£
Ä㻹Óиö¸üºÃµÄÍƼöÂð£¿Óë´ó¼Òһͬ·ÖÏí……
Ïà¹ØÎĵµ£º
½ñÌìÔÚ¹äÂÛ̳µÄʱºò¿´µ½ÓÐÈ˽ò½òÀÖµÀ£º´ÓC++¸Éµ½×ªÐÍΪjavaÊÇÍ˲½
ÎÒ²»ÈÏΪÊÇÕâÑù£¬Ê×ÏÈÓ¦¸ÃÒ»¸öÈ˵ÄÐËȤ£¬¼ÓÉÏÕâÃÅÓïÑÔ£¬ÕâÃŹ¤×÷ÊÇ·ñ·ûºÏÄã
¸É×Ô¼ºÏ²»¶µÄÓïÑÔ±àÂë²ÅÊÇ×îÖØÒªµÄ£¬µ±È»java±È½ÏÈÝÒ׵㣬ÎÒÒ²ÊÇÕâÑùÈÏΪµÄ
µ«ÊÇjava²¢²»ÊÇ´ó¼ÒËù˵µÄÄÇôÈÝÒ×£¬µ±½ñÉç»á˲»¸Ò˵×Ô¼º»ássh£¬µ±ÊÇ×Ô¼ºÎÊÐÄ×Ô¼ºÑ§µÃÓжàºÃ£¬
ÔÚ ......
ÓÐʱ£¬ÎÒÃÇÔÚдһ¸ö¹¹Ô캯Êýʱ£¬¾³£ÒòΪËü°üº¬ÖÚ¶àµÄ²ÎÊý¶ø¿àÄÕ,Õâʱ¿ÉÒÔ¿¼ÂÇÓÃBuilderģʽÀ´´´½¨¶ÔÏó¡£
È磬ÎÒÃÇÒªÉè¼ÆÒ»¸öÓªÑø³É·ÝµÄÀ࣬°üº¬ÄÜÁ¿£¬µ°°×ÖÊ£¬Ö¬·¾£¬¸Æ£¬Ìú£¬Ð¿£¬Î¬ÉúËØA, άÉúËØB1 ... µÈ£¬µ«ÔÚ¹¹ÔìµÄʱºò£¬²»Ò»¶¨Ã¿´Î¶¼ÐèÒªÕâЩ²ÎÊý£¬Èç¸Æ£¬Ìú£¬Ð¿ºÍάÉúËصÈÊÇ¿ÉÑ¡µÄ£¬ÎªÁËÊÊÓ¦¶àÖÖ¿ÉÄܵĴîÅ䣬±È½ÏÔʼ ......
Finalizer ²»¿É¼Æ»®µÄ,Ò²ÊÇΣÏÕµÄ,Ò»°ãÒ²ÊDz»±ØÒªµÄ.
²»ÄÜÔÚfinalizerÖзÅÈκÎÓëÒÀÀµÊ±¼äÏà¹ØµÄ²Ù×÷,ÒòΪÄã²»ÖªµÀËüʲôʱºò±»Ö´ÐÐ. ±ÈÈçÔÚfinalizerÖйرÕÎļþµÄ×ö·¨¾ÍÊÇ´íÎóµÄ, ¸ù¾ÝJVMµÄʵÏÖ·½Ê½²»Í¬,ÓпÉÄܵ¼Ö´ò¿ªµÄÎļþÊý¹ý¶à¶øÎÞ·¨ÔÙ´ò¿ªÎļþ.
Ò²²»ÄÜÔÚfinalizerÖиıä״̬,Èç¸øÊý¾Ý¿â½âËøµÈ.
finalizer»¹ÄÜ´øÀ´Ñ ......
ÔÚJSPÀ»ñÈ¡¿Í»§¶ËµÄIPµØÖ·µÄ·½·¨ÊÇ£ºrequest.getRemoteAddr()£¬ÕâÖÖ·½·¨Ôڴ󲿷ÖÇé¿ö϶¼ÊÇÓÐЧµÄ¡£µ«ÊÇÔÚͨ¹ýÁËApache,SquidµÈ·´Ïò´úÀíÈí¼þ¾Í²»ÄÜ»ñÈ¡µ½¿Í»§¶ËµÄÕæʵIPµØÖ·ÁË¡£
Èç¹ûʹÓÃÁË·´Ïò´úÀíÈí¼þ£¬½«http://192.168.1.110:2046/ µÄURL·´Ïò´úÀíΪhttp://www.xxx.com/ µÄURLʱ£¬ÓÃrequest.getRemoteAddr()·½·¨»ñÈ¡ ......
ÏîÄ¿ÖÐÓõ½web service£¬ÓÚÊÇÑо¿Á˶þÌ죬ÏÂÃæ¸ù¾ÝÕâ¶þÌìÓõ½µÄ×ܽáһϣ¬µ±È»×î¶àµÄ»¹ÊǸù¾Ýapache cxf¹ÙÍøÎĵµhttp://cxf.apache.org ¿´Îĵµ£¬µ±È»Ò²²»ÊǶ¼¿´£¬Ö»¿´ÁË×Ô¼ºÐèÒªµÄ¡£
»ù´¡ÖªÊ¶Ñ§Ï°—— Hello Demo
Hello Demo¿ªÊ¼ÁË£¡
µÚÒ»£¬Ð½¨HelloDemo Web ÏîÄ ......