public class MetadataReaderClasspathResourceScanner extends Object implements ClasspathResourceScanner, org.springframework.context.ResourceLoaderAware
This class implements ClasspathResourceScanner
by leveraging Spring Framework components.
This class can be used in either way, defining a bean in the application context
or invoking the static newInstance(ServletContext)
method.
The former is convenient for the applications which already use Spring Framework,
while the latter is convenient for the applications which don't use Spring Framework.
Constructor and Description |
---|
MetadataReaderClasspathResourceScanner() |
Modifier and Type | Method and Description |
---|---|
static MetadataReaderClasspathResourceScanner |
newInstance(javax.servlet.ServletContext servletContext)
Create an instance with setting the proper
ResourceLoader object. |
Set<String> |
scanClassNamesAnnotatedBy(Class<? extends Annotation> annotationType,
boolean matchSuperClass,
String... locationPatterns)
Scans classpath from the location specified by
locationPatterns
for all class names which annotates the speified annotationType . |
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) |
public MetadataReaderClasspathResourceScanner()
public static MetadataReaderClasspathResourceScanner newInstance(javax.servlet.ServletContext servletContext)
ResourceLoader
object.
If there's any web application context already, then the existing web application context is used
as ResourceLoader
. Otherwise, it creates a ResourceLoader
internally for convenience.servletContext
- public Set<String> scanClassNamesAnnotatedBy(Class<? extends Annotation> annotationType, boolean matchSuperClass, String... locationPatterns)
ClasspathResourceScanner
locationPatterns
for all class names which annotates the speified annotationType
.
Note: An implementation is recommended to support locationPattern
with classpath*:
prefix at least
like the following example:
scanClassNamesAnnotatedBy
in interface ClasspathResourceScanner
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader
in interface org.springframework.context.ResourceLoaderAware
Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.