@Target(value=TYPE) @Retention(value=RUNTIME) @Documented @ComponentScan(useDefaultFilters=false) public @interface FrameworkControllerScan
By default, scan the locations specified in value() or basePackages() or
basePackageClasses() for FrameworkRestController and FrameworkController
so that their FrameworkMappings will get included in
FrameworkMappingHandlerMapping to provide default implementations of web endpoints.
If there is no need to scan for both FrameworkController and
FrameworkRestController, supply only one of them to includeFilters().
If only some specific controllers are desired, then use excludeFilters() to disable
undesired default controllers.
DO NOT place this annotation on the same class as another ComponentScan or other
annotations that compose ComponentScan such as SpringBootApplication as they will
conflict when Spring performs annotation composition. Instead, you can create a nested class
in your SpringBootApplication class like this:
@SpringBootApplicationpublic class MyApplication {@FrameworkControllerScan(basePackages = "com.mypackage.packagewithcontrollers")static class EnableBroadleafControllers {} public static void main(String[] args) { SpringApplication.run(MyApplication.class, args); } }}
FrameworkRestController,
FrameworkController,
FrameworkMappingHandlerMapping| Modifier and Type | Optional Element and Description |
|---|---|
Class<?>[] |
basePackageClasses |
String[] |
basePackages |
org.springframework.context.annotation.ComponentScan.Filter[] |
excludeFilters
A set of
ComponentScan.Filters that describe classes to exclude from component
scanning. |
org.springframework.context.annotation.ComponentScan.Filter[] |
includeFilters
A set of
ComponentScan.Filters that describe which type of framework controllers to
look for. |
String[] |
value |
@AliasFor(annotation=org.springframework.context.annotation.ComponentScan.class,
attribute="value")
public abstract String[] value
@AliasFor(annotation=org.springframework.context.annotation.ComponentScan.class,
attribute="basePackages")
public abstract String[] basePackages
@AliasFor(annotation=org.springframework.context.annotation.ComponentScan.class,
attribute="basePackageClasses")
public abstract Class<?>[] basePackageClasses
@AliasFor(annotation=org.springframework.context.annotation.ComponentScan.class,
attribute="includeFilters")
public abstract org.springframework.context.annotation.ComponentScan.Filter[] includeFilters
ComponentScan.Filters that describe which type of framework controllers to
look for.
By default, scans for both FrameworkRestControllers and
FrameworkControllers.ComponentScan.includeFilters(),
ComponentScan.Filter@AliasFor(annotation=org.springframework.context.annotation.ComponentScan.class,
attribute="excludeFilters")
public abstract org.springframework.context.annotation.ComponentScan.Filter[] excludeFilters
ComponentScan.Filters that describe classes to exclude from component
scanning.
This is most useful when you want to enable some framework controllers but exclude others.
You can exclude classes annotated with FrameworkController or
FrameworkRestController by providing a filter like
@FrameworkControllerScan(excludeFilters = @Filter(value = DefaultCustomerController.class, type =
FilterType.ASSIGNABLE_TYPE))
ComponentScan.excludeFilters(),
ComponentScan.FilterCopyright © 2019. All rights reserved.