??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲黄片毛片在线观看,亚洲中文字幕乱码熟女在线,亚洲黄色片免费看http://www.tkk7.com/zhaijianhui/category/11283.html研究java技?/description>zh-cnFri, 02 Mar 2007 14:47:38 GMTFri, 02 Mar 2007 14:47:38 GMT60spring集成到web框架http://www.tkk7.com/zhaijianhui/archive/2006/08/02/61423.html蜘蛛蜘蛛Wed, 02 Aug 2006 15:41:00 GMThttp://www.tkk7.com/zhaijianhui/archive/2006/08/02/61423.htmlhttp://www.tkk7.com/zhaijianhui/comments/61423.htmlhttp://www.tkk7.com/zhaijianhui/archive/2006/08/02/61423.html#Feedback0http://www.tkk7.com/zhaijianhui/comments/commentRss/61423.htmlhttp://www.tkk7.com/zhaijianhui/services/trackbacks/61423.html把spring集成到web框架很简单,只要在web.xml里面加上
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext*.xml</param-value>
</context-param>
或?br /><listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
如果Z面这U方式的话,那么是加蝲默认的文?br />/WEB-INF/applicationContext.xml
q个?br />
org.springframework.web.context.support.XmlWebApplicationContextc里面定义的,,部分代码Q?br />/** Default config location for the root context */
 public static final String DEFAULT_CONFIG_LOCATION = "/WEB-INF/applicationContext.xml";

 /** Default prefix for building a config location for a namespace */
 public static final String DEFAULT_CONFIG_LOCATION_PREFIX = "/WEB-INF/";

 /** Default suffix for building a config location for a namespace */
 public static final String DEFAULT_CONFIG_LOCATION_SUFFIX = ".xml";


Once the context files are loaded, Spring creates a WebApplicationContext object based on the bean definitions and puts it into the ServletContext.
q样我们可以直接用ServletContext获取自己惌的参数的Q,

All Java web frameworks are built on top of the Servlet API, so you can use the following code to get the ApplicationContext that Spring created.

WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(servletContext);

通过WebApplicationContext我们可以通过bean的名字获取它的实例了
The WebApplicationContextUtils class is for convenience, so you don't have to remember the name of the ServletContext attribute. Its getWebApplicationContext() method will return null if an object doesn't exist under the WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE key. Rather than risk getting NullPointerExceptions in your application, it's better to use the getRequiredWebApplicationContext() method. This method throws an Exception when the ApplicationContext is missing.

Once you have a reference to the WebApplicationContext, you can retrieve beans by their name or type. Most developers retrieve beans by name, then cast them to one of their implemented interfaces.

Fortunately, most of the frameworks in this section have simpler ways of looking up beans. Not only do they make it easy to get beans from the BeanFactory, but they also allow you to use dependency injection on their controllers. Each framework section has more detail on its specific integration strategies.



蜘蛛 2006-08-02 23:41 发表评论
]]>
d配置文g的几U方?/title><link>http://www.tkk7.com/zhaijianhui/archive/2006/06/03/50104.html</link><dc:creator>蜘蛛</dc:creator><author>蜘蛛</author><pubDate>Sat, 03 Jun 2006 03:24:00 GMT</pubDate><guid>http://www.tkk7.com/zhaijianhui/archive/2006/06/03/50104.html</guid><wfw:comment>http://www.tkk7.com/zhaijianhui/comments/50104.html</wfw:comment><comments>http://www.tkk7.com/zhaijianhui/archive/2006/06/03/50104.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/zhaijianhui/comments/commentRss/50104.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/zhaijianhui/services/trackbacks/50104.html</trackback:ping><description><![CDATA[在读spring in aciton Ӟ他用的BeanFactory factory = new XmlBeanFactory(new FileInputStream("hello.xml"));<br />可是现在的用?.2.6版本的构造器(XmlBeanFactory)只能接收Resource接口了,所以调不出来是正常的事情,假设现在有一个文件hello.xml<br />dҎ<br /><br />1:ApplicationContext cx=new FileSystemXmlApplicationContext("hello.xml");//指定的\径去找文?br />2:ApplicationContext factory = new ClassPathXmlApplicationContext("hello.xml");//q会在classpathL<br />3:Resource fa = new FileSystemResource("hello.xml");<br />   BeanFactory factory=new XmlBeanFactory(fa);<br />4:q个要设制classpath了,ȝ<br />  Resource res = new ClassPathResource("com/springinaction/chapter01/hello/hello.xml");<br />  BeanFactory factory=new XmlBeanFactory(res);<br />好了Q用了上面U方法都可以调用getBean("your bean name")了,<br />eg: BeanFactory factory=new XmlBeanFactory(fa);<br />      hello he=(hello)factory.getBean("hello");<br />              he.getHello();<img src ="http://www.tkk7.com/zhaijianhui/aggbug/50104.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/zhaijianhui/" target="_blank">蜘蛛</a> 2006-06-03 11:24 <a href="http://www.tkk7.com/zhaijianhui/archive/2006/06/03/50104.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>spring入门与实?/title><link>http://www.tkk7.com/zhaijianhui/archive/2006/06/01/49380.html</link><dc:creator>蜘蛛</dc:creator><author>蜘蛛</author><pubDate>Wed, 31 May 2006 17:37:00 GMT</pubDate><guid>http://www.tkk7.com/zhaijianhui/archive/2006/06/01/49380.html</guid><wfw:comment>http://www.tkk7.com/zhaijianhui/comments/49380.html</wfw:comment><comments>http://www.tkk7.com/zhaijianhui/archive/2006/06/01/49380.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.tkk7.com/zhaijianhui/comments/commentRss/49380.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/zhaijianhui/services/trackbacks/49380.html</trackback:ping><description><![CDATA[Z方便大家更快的学习SpringQ特整理了第一个实例,<br />做成了pdf格式,q附带源代码Q欢q下?br />开发^?br />myeclipse 4.1.1GA<br />eclipse 3.1.2<br />你也可以选择其它开发工?q不影响你阅L教程.<a href="/Files/zhaijianhui/spring"><br />http://www.tkk7.com/Files/zhaijianhui/spring</a>入门.rar<img src ="http://www.tkk7.com/zhaijianhui/aggbug/49380.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/zhaijianhui/" target="_blank">蜘蛛</a> 2006-06-01 01:37 <a href="http://www.tkk7.com/zhaijianhui/archive/2006/06/01/49380.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>лǵվܻԴȤ</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> վ֩ģ壺 <a href="http://www611rr.com" target="_blank">޾ƷþþþAVƬ</a>| <a href="http://spxingyiquan.com" target="_blank">ҹҹþ</a>| <a href="http://gysysz.com" target="_blank">ŮҼxx00Ƶ</a>| <a href="http://jt4f.com" target="_blank">պaa߿</a>| <a href="http://wwwkckc.com" target="_blank">avһ߲</a>| <a href="http://boyipark.com" target="_blank">Ůվ߿</a>| <a href="http://xdxdl.com" target="_blank">ɫƷվ</a>| <a href="http://pohezi.com" target="_blank">ŮƵ</a>| <a href="http://chuoche.com" target="_blank">պavþþƷ</a>| <a href="http://ksyy888.com" target="_blank">ҹƵ</a>| <a href="http://51708695.com" target="_blank">һƵ</a>| <a href="http://caobi97.com" target="_blank">˳ۺվ7777㽶</a>| <a href="http://www8x5188x.com" target="_blank">ԺѵȫƵ</a>| <a href="http://qdhengjun.com" target="_blank">˾Ʒvideos</a>| <a href="http://xzzkf.com" target="_blank">91ƷѲ߹ۿ</a>| <a href="http://pencilinside.com" target="_blank">޾Ʒɫ߷</a>| <a href="http://yunyitai.com" target="_blank">www.999ƷƵۿ</a>| <a href="http://av-fantasy.com" target="_blank">뾫Ʒ</a>| <a href="http://lshwork.com" target="_blank">ĻþƷѹۿ</a>| <a href="http://0101av.com" target="_blank">ƷžžþƵ </a>| <a href="http://55xxb.com" target="_blank">ѹۿ</a>| <a href="http://pgyadv.com" target="_blank">Ƶۿ</a>| <a href="http://scienfood.com" target="_blank">Ʒһ߹ۿ</a>| <a href="http://gbn21.com" target="_blank">ٸԼA </a>| <a href="http://www97544.com" target="_blank">2022ھƷѸƵ</a>| <a href="http://www-44455588.com" target="_blank">˾Ʒձվ</a>| <a href="http://aaaaa123.com" target="_blank">2021ھƷþþþþ</a>| <a href="http://jsjumei.com" target="_blank">ŷۺϾþþ</a>| <a href="http://7x966.com" target="_blank">ɫƵ</a>| <a href="http://6266tv.com" target="_blank">yyƵ</a>| <a href="http://1444000.com" target="_blank">ƷAV鶹 </a>| <a href="http://556228.com" target="_blank">ѴƬavֻƬ</a>| <a href="http://mmstom.com" target="_blank">þþƷ69Ʒ</a>| <a href="http://6132423.com" target="_blank">Ļ</a>| <a href="http://dqcjlb.com" target="_blank">vaĻ</a>| <a href="http://htsp777.com" target="_blank">˳ɫ77777</a>| <a href="http://gsonlinet.com" target="_blank">ڵƵ߹ۿ</a>| <a href="http://140699.com" target="_blank">һŮȫƬѿ</a>| <a href="http://500308k.com" target="_blank">޾Ʒmv߹ۿ</a>| <a href="http://cqtjqcc.com" target="_blank">޹Ʒþ</a>| <a href="http://xuanboart.com" target="_blank">߹ۿƵ</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>