testing new bean scopes with spring 2.0 - example
<bean id="scopedBean" class="org.bla.ScopedBeanImpl" scope="session"> <aop:scoped-proxy /> </bean>
// an example test case
public class ScopedBeanTest extends AbstractRequestContextFilterTestBase { protected String[] getConfigLocations() { return new String[] { "classpath:applicationContext-with-scopedBean.xml" }; } @Test public void testScopedBean() throws Exception { new FilterTest(new FilterChain() { public void doFilter(ServletRequest arg0, ServletResponse arg1) throws IOException, ServletException { ScopedBean scopedBean = (ScopedBean) applicationContext .getBean("scopedBean"); ... /* * let the classses under test do something with your scopedBean * and check if modifications are done correctly */ ... } }).run(); }