Annotation Interface EnableBroadleafSiteServletAutoConfiguration
Bootstraps Broadleaf site configuration XML for only servlet beans in use with a traditional MVC application. If you are deploying Broadleaf in a
REST-API-only capacity or any other way then this annotation is probably not for you, and instead just EnableBroadleafSiteRootAutoConfiguration
is sufficient.If you have a customized ServletContainerInitializer
with a servlet-specific ApplicationContext
, this annotation should only be placed on an @Configuration class within
that servlet-specific . If this is not the case and no servlet-specific ApplicationContext
exists in your
project and you are using Spring Boot, this must be placed on an inner static class within the @SpringBootApplication class. Example:
@SpringBootApplication public class MyApplication extends SpringBootServletInitializer { @Configuration @EnableBroadleafSiteServletAutoConfiguration public static class BroadleafConfiguration { } public static void main(String[] args) { SpringApplication.run(ApiApplication.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(ApiApplication.class); } }
Since this annotation is a meta-annotation for @Import, this can be placed on a @Configuration class that contains an @Import annotation, but this @Import's beans will take precedence over any additional @Import applied.
This annotation assumes that you have activated the root configuration via EnableBroadleafAdminRootAutoConfiguration
in a parent
context. However, rather than using this annotation in a parent-child configuration consider using EnableBroadleafSiteAutoConfiguration
to
ensure that only a single ApplicationContext
is present, or just use the EnableBroadleafAutoConfiguration
This import utilizes the FrameworkXmlBeanDefinitionReader
so that framework XML bean definitions will not
overwrite beans defined in a project.
- Since:
- 5.2
- Author:
- Phillip Verheyden (phillipuniverse), Nick Crum (ncrum)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
We are deliberately leaving off theConfiguration
annotation since this inner class is being included in theImport
above, which interprets this as aConfiguration
.static class