´«ÖDz¥¿Íjavaѧϰ Spring³õ²½
ÎÒ½ñÌìѧϰÁËÐìÀÏʦ½²µÄSpring֪ʶ£¬ÎÒ×öÁ˼òµ¥µÄ±Ê¼Ç£º
·´Ïò¿ØÖÆ(IOC)
£º
bean¹¤³§:×î¼òµ¥µÄÈÝÆ÷£¬ÌṩÁË»ù´¡µÄÒÀÀµ×¢ÈëÖ§³Ö¡£´´½¨¸÷ÖÖÀàÐ͵ÄBean.
Ó¦ÓÃÉÏÏÂÎÄ:½¨Á¢ÔÚbean¹¤³§»ù´¡Ö®ÉÏ£¬Ìṩϵͳ¼Ü¹¹·þÎñ¡£
ClassPathXmlApplicationContext:´ÓÀà·¾¶ÖмÓÔØ¡£
FileSystemXmlApplicationContext:´ÓÎļþϵͳ¼ÓÔØ¡£
XmlWebApplicationContext:´ÓwebϵͳÖмÓÔØ¡£
Ó¦ÓÃÉÏÏÂÎÄÓëbean
¹¤³§µÄÇø±ð£º
bean¹¤³§ÑÓ³Ù¼ÓÔØËùÓÐbean£¬Ö±µ½getBean()·½·¨±»µ÷Óá£
Ó¦ÓÃÉÏÏÂÎÄ»áÔÚÆô¶¯ºóÔ¤ÔØÈëËùÓе¥Àýbean.ÕâÑù¿ÉÈ·±£Ó¦Óò»ÐèÒªµÈ´ýËûÃDZ»´´½¨¡£
bean
µÄÉúÃüÖÜÆÚ
bean±»ÔØÈëµ½ÈÝÆ÷ÖÐʱ£¬ËûµÄÉúÃüÖÜÆھͿªÊ¼ÁË¡£bean¹¤³§ÔÚÒ»¸öbean¿ÉÒÔʹÓÃÇ°Íê³ÉºÜ¶à¹¤×÷£º
1.ÈÝÆ÷Ñ°ÕÒbeanµÄ¶¨ÒåÐÅÏ¢²¢ÊµÀý»¯¡£
2.ʹÓÃÒÀÀµ×¢È룬spring°´bean¶¨ÒåÐÅÏ¢ÅäÖÃbeanµÄËùÓÐÊôÐÔ¡£
3.ÈôbeanʵÏÖÁËBeanNameAware½Ó¿Ú£¬¹¤³§µ÷ÓÃBeanµÄsetBeanName
£¨£©·½·¨´«µÝbeanµÄID¡£
4.ÈôbeanʵÏÖÁËBeanFactoryAware½Ó¿Ú£¬¹¤³§µ÷ÓÃsetBeanFactory£¨£©
·½·¨´«È빤³§×ÔÉí¡£
5.ÈôBeanPostProcessorºÍbean¹ØÁª£¬ÔòËüÃǵÄ
postProcessBeforeInitialization()·½·¨±»µ÷Óá£
6.ÈôbeanÖ¸¶¨ÁËini-method·½·¨¡¢£¬Ëü½«±»µ÷Óá£
7.×îºó£¬ÈôÓÐBeanPostProcessorºÍbean¹ØÁª£¬ÔòËüÃǵÄ
postProcessAfterInitialization()·½·¨±»µ÷Óᢡ£
½«bean´Ó¹¤³§ÖÐɾµôÓÐÁ½ÖÖ·½·¨£º
1.ÈôbeanʵÏÖÁËDisposableBean½Ó¿Ú£¬
distroy()·½·¨±»µ÷Óá£
2.Èç¹ûÖ¸¶¨Á˶¨ÖƵÄÏú»Ù·½·¨£¬¾Íµ÷ÓÃÕâ¸ö·½·¨¡£
beanÔÚÓ¦ÓÃÉÏÏÂÎÄÖеÄÉúÃüÖÜÆÚºÍÔÚbean¹¤³§
µÄÉúÃüÖÜÆÚΨһ²»Í¬µÄÊÇ£ºÈôbeanʵÏÖÁË
ApplicationContextAware()½Ó¿Ú£¬
setApplicationContext()·½·¨»á±»µ÷Óá£
¶Ôbean
¹¤³§½øÐкó´¦Àí£º
BeanPostProcessorÔÚbeanÔØÈëºó£¬¶Ôbean½øÐÐһЩºó´¦Àí¹¤×÷¡£¶øBeanFactoryPostProcessorÔÚbean¹¤³§ÔØÈëËùÓÐbeanµÄ¶¨Òåºó£¬ÊµÀý»¯bean֮ǰ£¬¶ÔBean¹¤³§×öһЩºó´¦Àí¹¤×÷¡£
¡¡ public
interface BeanFactoryPostProcessor{
public void postProcessorBeanFactory(…);
}
Èç¹ûʹÓõÄÊÇÓ¦ÓÃÉÏÏÂÎIJ»ÐèÒ
Ïà¹ØÎĵµ£º
³¢ÊÔÓÃDOM4j½âÎöspringÅäÖÃÎļþʱ,µÚÒ»²½¶ÁÈ¡Îļþʱ£¬»ñȡ·¾¶¾ÍÓöµ½ÁËÎÊÌ⣬¡£¡£¡£¾¹ýgoogleÁËn+log n ´Î¸öÒ³Ã棬²ÅËãÓÐÁ˸ö´ÖdzµÄÈÏʶ£¬ÏÂÃæ¾ÍÈÃÎÒÓüò¶ÌµÄ»°ÓïÀ´×ܽáһϣ¨ºÃÏñÕâ¶Î¾ÍÈ«ÊÇ·Ï»°¡£¡£¡££©¡£¡£¡£
1¡¢springµÄÅäÖÃÎļþ´æ·ÅλÖÃÓÉweb.xmlÀïµÄcontextConfigLocationÀ´È·¶¨£¬Ò»°ãÊÇ·ÅÔÚweb-inf»òÕßÊÇsrc¸ùÄ¿Â¼Ï ......
¶ÔÓÚÕâ¸öϵÁÐÀïµÄÎÊÌ⣬ÿ¸öѧJavaµÄÈ˶¼Ó¦¸Ã¸ã¶®¡£µ±È»£¬Èç¹ûÖ»ÊÇѧJavaÍæÍæ¾ÍÎÞËùνÁË¡£Èç¹ûÄãÈÏΪ×Ô¼ºÒѾ³¬Ô½³õѧÕßÁË£¬È´²»ºÜ¶®ÕâЩÎÊÌ⣬Ç뽫Äã×Ô¼ºÖعé³õѧÕßÐÐÁС£ÄÚÈݾùÀ´×ÔÓÚCSDNµÄ¾µäÀÏÌù¡£
ÎÊÌâÒ»£ºÎÒÉùÃ÷ÁËʲô£¡
String s = "Hello world!";
¡¡Ðí¶àÈ˶¼×ö¹ýÕâÑùµÄÊÂÇ飬µ«ÊÇ£¬ÎÒÃǵ½µ×ÉùÃ÷ÁËʲô£¿»Ø´ðͨ ......
Long long ago in a galaxy far,far away......
HakunaMatata
Ö÷Ò³²©¿ÍÏà²á|¸öÈ˵µ°¸ |ºÃÓÑ
²é¿´ÎÄÕÂ
ΪʲôҪÉèÖÃJAVA_HOME&Path&CLASSPATH&CATALINA_HOME
2008-01-19 14:26
Ê×ÏȵýéÉÜÏÂÃ漸¸ö²ÎÊýµÄ×÷Óãº
current directory(µ±Ç°Ä¿Â¼)£º
µ±Ç°ÔÚÓõÄĿ¼ ......
import java.util.regex.Matcher;
import java.util.regex.Pattern;
1£ºÕâ¸öÊÇÄõ½Ò»¸ö×Ö·ûÈ¡µÃÀïÃæµÄͼÏñµØÖ··µ»ØÒ»¸öList
public static List<String> getImgStr(String htmlStr){
String img=""; &n ......
Integer n1 = new Integer(1);
Integer n2 = new Integer(1);
System.out.println(n1==n2); // false
Integer n1 = new Integer(3);
Integer n2 = new Integer(3);
System.out.println(n1.equals(n2)); //true
equals()ĬÈÏÒ²ÊDZȽÏreference£¬µ«ÊÇJavaÖеÄclass¸²¸ÇÁËequals()·½·¨ ......