Annotation Type ServletComponentScan
@Target(TYPE)
@Retention(RUNTIME)
@Documented
@Import(org.springframework.boot.web.servlet.ServletComponentScanRegistrar.class)
public @interface ServletComponentScan
Enables scanning for Servlet components (
filters
, servlets
, and listeners
). Scanning is only performed when using an
embedded web server.
Typically, one of value
, basePackages
, or basePackageClasses
should be specified to control the packages to be scanned for components. In their
absence, scanning will be performed from the package of the class with the annotation.
- Since:
- 1.3.0
- Author:
- Andy Wilkinson
- See Also:
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionClass<?>[]
Type-safe alternative tobasePackages()
for specifying the packages to scan for annotated servlet components.String[]
Base packages to scan for annotated servlet components.String[]
Alias for thebasePackages()
attribute.
-
Element Details
-
value
Alias for thebasePackages()
attribute. Allows for more concise annotation declarations e.g.:@ServletComponentScan("org.my.pkg")
instead of@ServletComponentScan(basePackages="org.my.pkg")
.- Returns:
- the base packages to scan
- Default:
- {}
-
basePackages
Base packages to scan for annotated servlet components.value()
is an alias for (and mutually exclusive with) this attribute.Use
basePackageClasses()
for a type-safe alternative to String-based package names.- Returns:
- the base packages to scan
- Default:
- {}
-
basePackageClasses
Class<?>[] basePackageClassesType-safe alternative tobasePackages()
for specifying the packages to scan for annotated servlet components. The package of each class specified will be scanned.- Returns:
- classes from the base packages to scan
- Default:
- {}
-