JBoss.orgCommunity Documentation

Snowdrop 1.0

User Guide

This chapter details how to use the individual components of the package.

For using this functionality, the snowdrop-vfs.jar file needs to be added to the application.

This library supports resource scanning in JBoss' Virtual File System. When doing resource scanning, the Spring framework assumes that the resources are either coming from a directory or a packaged jar, and treats the URLs encountered in the process of scanning resources accordingly. This assumption does not hold in JBoss' Virtual File System.

The solution to this problem is in implementing a different underlying resource resolution mechanism, namely in amending the functionality of the PathMatchingResourcePatternResolver. From the user's perspective, using this different resolution mechanism is done through using one of the two ApplicationContext implementations provided by this library, which are:

In many cases, the VFSClassPathXmlApplicationContext would be instantiated on its own, using something like:

ApplicationContext context = 
  new VFSClassPathXmlApplicationContext("classpath:/context-definition-file.xml");

The XmlWebApplicationContext is not instantiated directly, though, but bootstrapped by either the ContextLoaderListener, or the DispatcherServlet. In this case, the class to be used for bootstrapping needs to be used to trigger an instantiation of the VFS-enabled context.

For changing the type of application context created by the ContextLoaderListener, use the contextClass parameter, as shown in the sample below:

For changing the type of application context created by the DispatcherServlet, use the contextClass parameter again, but this time on the DispatcherServlet definition (emphasized portion again):


Both configurations can be seen at work in the web-scanning sample.

The role of the Spring Deployer is to allow the bootstrapping of a Spring application context, binding it in JNDI and using it for providing Spring-configured business object instances.