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 serve_openapi_ui(
self,
path: impl Into<String>,
document_path: impl Into<String>,
info: OpenApiInfo,
) -> Self
pub fn serve_openapi_ui( self, path: impl Into<String>, document_path: impl Into<String>, info: OpenApiInfo, ) -> Self
Serve a generated OpenAPI document and a Swagger UI page for it.
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 exclude_global_prefix<I>(self, routes: I) -> Selfwhere
I: IntoIterator<Item = MiddlewareRoute>,
pub fn exclude_global_prefix<I>(self, routes: I) -> Selfwhere
I: IntoIterator<Item = MiddlewareRoute>,
Exclude selected HTTP routes from the application-wide global prefix.
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_websocket_pipe<P>(self, pipe: P) -> Selfwhere
P: WebSocketPipe,
pub fn use_global_websocket_pipe<P>(self, pipe: P) -> Selfwhere
P: WebSocketPipe,
Add an application-wide WebSocket pipe.
Sourcepub fn use_global_websocket_guard<G>(self, guard: G) -> Selfwhere
G: WebSocketGuard,
pub fn use_global_websocket_guard<G>(self, guard: G) -> Selfwhere
G: WebSocketGuard,
Add an application-wide WebSocket guard.
Sourcepub fn use_global_websocket_interceptor<I>(self, interceptor: I) -> Selfwhere
I: WebSocketInterceptor,
pub fn use_global_websocket_interceptor<I>(self, interceptor: I) -> Selfwhere
I: WebSocketInterceptor,
Add an application-wide WebSocket interceptor.
Sourcepub fn use_global_transport_pipe<P>(self, pipe: P) -> Selfwhere
P: TransportPipe,
pub fn use_global_transport_pipe<P>(self, pipe: P) -> Selfwhere
P: TransportPipe,
Add an application-wide transport pipe.
Sourcepub fn use_global_transport_guard<G>(self, guard: G) -> Selfwhere
G: TransportGuard,
pub fn use_global_transport_guard<G>(self, guard: G) -> Selfwhere
G: TransportGuard,
Add an application-wide transport guard.
Sourcepub fn use_global_transport_interceptor<I>(self, interceptor: I) -> Selfwhere
I: TransportInterceptor,
pub fn use_global_transport_interceptor<I>(self, interceptor: I) -> Selfwhere
I: TransportInterceptor,
Add an application-wide transport interceptor.
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_websocket_filter<F>(self, filter: F) -> Selfwhere
F: WebSocketExceptionFilter,
pub fn use_global_websocket_filter<F>(self, filter: F) -> Selfwhere
F: WebSocketExceptionFilter,
Add an application-wide WebSocket exception filter.
Sourcepub fn use_global_websocket_catch_filter<I, F>(
self,
kinds: I,
filter: F,
) -> Self
pub fn use_global_websocket_catch_filter<I, F>( self, kinds: I, filter: F, ) -> Self
Add an application-wide WebSocket exception filter for selected error kinds.
Sourcepub fn use_global_transport_filter<F>(self, filter: F) -> Selfwhere
F: TransportExceptionFilter,
pub fn use_global_transport_filter<F>(self, filter: F) -> Selfwhere
F: TransportExceptionFilter,
Add an application-wide transport exception filter.
Sourcepub fn use_global_transport_catch_filter<I, F>(
self,
kinds: I,
filter: F,
) -> Self
pub fn use_global_transport_catch_filter<I, F>( self, kinds: I, filter: F, ) -> Self
Add an application-wide transport 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 use_global_validation_options(self, options: ValidationOptions) -> Self
pub fn use_global_validation_options(self, options: ValidationOptions) -> Self
Enable DTO validation with Nest-style validation options.
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 override_module<M>(
self,
target_name: impl Into<String>,
module: M,
) -> Selfwhere
M: Module,
pub fn override_module<M>(
self,
target_name: impl Into<String>,
module: M,
) -> Selfwhere
M: Module,
Replace a module by name before the application graph is registered.
This is primarily used by testing utilities to mirror Nest’s
overrideModule(...).useModule(...) workflow. The replacement module is
registered wherever a module with the target name appears in the import
graph.
Sourcepub fn override_module_arc(
self,
target_name: impl Into<String>,
module: Arc<dyn Module>,
) -> Self
pub fn override_module_arc( self, target_name: impl Into<String>, module: Arc<dyn Module>, ) -> Self
Replace a shared module by name before the application graph is registered.
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.