pub struct BootApplicationBuilder { /* private fields */ }Expand description
Builder for a BootApplication.
Implementations§
Source§impl BootApplicationBuilder
impl BootApplicationBuilder
pub fn new() -> Self
Sourcepub fn import_arc(self, module: Arc<dyn Module>) -> Self
pub fn import_arc(self, module: Arc<dyn Module>) -> Self
Import a shared root module.
Sourcepub fn route(self, route: RouteDefinition) -> Self
pub fn route(self, route: RouteDefinition) -> Self
Add a framework-neutral route directly to the application shell.
Sourcepub fn gateway(self, gateway: WebSocketGatewayDefinition) -> Self
pub fn gateway(self, gateway: WebSocketGatewayDefinition) -> Self
Add a framework-neutral WebSocket gateway directly to the application shell.
Sourcepub fn message_pattern(self, pattern: MessagePatternDefinition) -> Self
pub fn message_pattern(self, pattern: MessagePatternDefinition) -> Self
Add a framework-neutral microservice message pattern directly to the application shell.
Sourcepub fn serve_openapi(self, path: impl Into<String>, info: OpenApiInfo) -> Self
pub fn serve_openapi(self, path: impl Into<String>, info: OpenApiInfo) -> Self
Serve a generated OpenAPI document at the given path.
Sourcepub fn global_prefix(self, prefix: impl Into<String>) -> Self
pub fn global_prefix(self, prefix: impl Into<String>) -> Self
Prefix every route in the built application, for example /api/v1.
Sourcepub fn enable_api_versioning(self, versioning: ApiVersioning) -> Self
pub fn enable_api_versioning(self, versioning: ApiVersioning) -> Self
Enable adapter-neutral API version matching for HTTP routes.
Sourcepub fn use_global_middleware<M>(self, middleware: M) -> Selfwhere
M: Middleware,
pub fn use_global_middleware<M>(self, middleware: M) -> Selfwhere
M: Middleware,
Add application-wide middleware, similar to Nest middleware.
Sourcepub fn use_global_pipe<P>(self, pipe: P) -> Selfwhere
P: Pipe,
pub fn use_global_pipe<P>(self, pipe: P) -> Selfwhere
P: Pipe,
Add an application-wide pipe, similar to Nest’s global pipes.
Sourcepub fn use_global_guard<G>(self, guard: G) -> Selfwhere
G: Guard,
pub fn use_global_guard<G>(self, guard: G) -> Selfwhere
G: Guard,
Add an application-wide guard, similar to Nest’s global guards.
Sourcepub fn use_global_execution_guard<G>(self, guard: G) -> Selfwhere
G: Guard,
pub fn use_global_execution_guard<G>(self, guard: G) -> Selfwhere
G: Guard,
Add an application-wide protocol-neutral guard.
Sourcepub fn use_global_interceptor<I>(self, interceptor: I) -> Selfwhere
I: Interceptor,
pub fn use_global_interceptor<I>(self, interceptor: I) -> Selfwhere
I: Interceptor,
Add an application-wide interceptor, similar to Nest’s global interceptors.
Sourcepub fn use_global_execution_interceptor<I>(self, interceptor: I) -> Selfwhere
I: ExecutionInterceptor,
pub fn use_global_execution_interceptor<I>(self, interceptor: I) -> Selfwhere
I: ExecutionInterceptor,
Add an application-wide protocol-neutral interceptor.
Sourcepub fn use_global_serialization(self) -> Self
pub fn use_global_serialization(self) -> Self
Add the default JSON response serialization interceptor.
Sourcepub fn use_global_filter<F>(self, filter: F) -> Selfwhere
F: ExceptionFilter,
pub fn use_global_filter<F>(self, filter: F) -> Selfwhere
F: ExceptionFilter,
Add an application-wide exception filter, similar to Nest’s global filters.
Sourcepub fn use_global_catch_filter<I, F>(self, kinds: I, filter: F) -> Self
pub fn use_global_catch_filter<I, F>(self, kinds: I, filter: F) -> Self
Add an application-wide exception filter for selected error kinds.
Sourcepub fn use_global_validation(self) -> Self
pub fn use_global_validation(self) -> Self
Enable DTO validation for routes that carry validation metadata.
Sourcepub fn override_provider(self, provider: ProviderDefinition) -> Self
pub fn override_provider(self, provider: ProviderDefinition) -> Self
Replace matching module providers before modules build controllers.
This is primarily used by testing utilities to swap provider implementations while preserving the application module graph.
Sourcepub fn build(self) -> Result<BootApplication>
pub fn build(self) -> Result<BootApplication>
Resolve module imports, providers, controllers, and routes.
Sourcepub async fn build_async(self) -> Result<BootApplication>
pub async fn build_async(self) -> Result<BootApplication>
Resolve modules with async provider factories, then build the application.