Class JuneauRestAutoConfiguration
java.lang.Object
org.apache.juneau.rest.server.springboot.JuneauRestAutoConfiguration
@AutoConfiguration
@ConditionalOnProperty(name="juneau.rest.auto-register",
havingValue="true",
matchIfMissing=false)
public class JuneauRestAutoConfiguration
extends Object
Opt-in Spring Boot auto-configuration that mounts every
RestServlet bean at its
self-declared top-level path without an explicit ServletRegistrationBean per servlet.
Activation:
Gated behind the property juneau.rest.auto-register=true (no default —
matchIfMissing=false); when the property is absent or any value other than true,
this auto-configuration contributes nothing and servlet registration stays fully manual. Set it
in application.properties / application.yaml:
juneau.rest.auto-register=true
Behavior:
When active, a single ServletContextInitializer bean walks all RestServlet beans
in the application context and, for each one:
- Skips it if its instance is already wired into a manual
ServletRegistrationBean(no double-mounts — explicit registrations always win). - Resolves its mount paths via
RestContext.resolveTopLevelPaths(...)(reading the top-levelpaths()/getPaths()chain — notpath()), using the application's registeredBeanStorefor SVL resolution. - Registers the servlet at each resolved path. A servlet that resolves to no top-level paths is skipped (it is presumably composed as a child or mounted some other way).
See Also:
- Since:
- 10.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.boot.web.servlet.ServletContextInitializerjuneauRestAutoRegistrar(org.springframework.context.ApplicationContext appContext) Contributes the auto-registration hook.
-
Constructor Details
-
JuneauRestAutoConfiguration
public JuneauRestAutoConfiguration()
-
-
Method Details
-
juneauRestAutoRegistrar
@Bean public org.springframework.boot.web.servlet.ServletContextInitializer juneauRestAutoRegistrar(org.springframework.context.ApplicationContext appContext) Contributes the auto-registration hook.- Parameters:
appContext- The Spring application context (source ofRestServletbeans, existingServletRegistrationBeanbeans, and theBeanStore).- Returns:
- A
ServletContextInitializerthat mounts un-registered Juneau servlets.
-