Over a million developers have joined DZone.

Testing New Bean Scopes With Spring 2.0 - Example

DZone's Guide to

Testing New Bean Scopes With Spring 2.0 - Example

Free Resource
// scoped bean definition


// an example test case

public class ScopedBeanTest extends AbstractRequestContextFilterTestBase {

	protected String[] getConfigLocations() {
		return new String[] { "classpath:applicationContext-with-scopedBean.xml" };

	public void testScopedBean() throws Exception {

		new FilterTest(new FilterChain() {

			public void doFilter(ServletRequest arg0, ServletResponse arg1)
					throws IOException, ServletException {
				ScopedBean scopedBean = (ScopedBean) applicationContext
				 * let the classses under test do something with your scopedBean
				 * and check if modifications are done correctly 



Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}