<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: bean code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Mon, 08 Sep 2008 08:26:36 GMT</pubDate>
    <description>DZone Snippets: bean code</description>
    <item>
      <title>testing new bean scopes with spring 2.0 - example</title>
      <link>http://snippets.dzone.com/posts/show/3001</link>
      <description>// scoped bean definition&lt;br /&gt;&lt;code&gt;&lt;br /&gt;	&lt;bean id="scopedBean"&lt;br /&gt;		class="org.bla.ScopedBeanImpl"&lt;br /&gt;		scope="session"&gt;&lt;br /&gt;		&lt;aop:scoped-proxy /&gt;&lt;br /&gt;	&lt;/bean&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;// an example test case&lt;br /&gt;&lt;code&gt;&lt;br /&gt;public class ScopedBeanTest extends AbstractRequestContextFilterTestBase {&lt;br /&gt;&lt;br /&gt;	protected String[] getConfigLocations() {&lt;br /&gt;		return new String[] { "classpath:applicationContext-with-scopedBean.xml" };&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;	@Test&lt;br /&gt;	public void testScopedBean() throws Exception {&lt;br /&gt;&lt;br /&gt;		new FilterTest(new FilterChain() {&lt;br /&gt;&lt;br /&gt;			public void doFilter(ServletRequest arg0, ServletResponse arg1)&lt;br /&gt;					throws IOException, ServletException {&lt;br /&gt;				ScopedBean scopedBean = (ScopedBean) applicationContext&lt;br /&gt;						.getBean("scopedBean");&lt;br /&gt;				...&lt;br /&gt;				/* &lt;br /&gt;				 * let the classses under test do something with your scopedBean&lt;br /&gt;				 * and check if modifications are done correctly &lt;br /&gt;				 */&lt;br /&gt;				...&lt;br /&gt;			}&lt;br /&gt;&lt;br /&gt;		}).run();&lt;br /&gt;&lt;br /&gt;	}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 15 Nov 2006 18:15:01 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3001</guid>
      <author>awurzer (Andreas Wurzer)</author>
    </item>
  </channel>
</rss>
