Package io.micronaut.servlet.engine
Class MicronautServletConfiguration
java.lang.Object
io.micronaut.servlet.engine.MicronautServletConfiguration
- All Implemented Interfaces:
io.micronaut.core.naming.Named
,ServletConfiguration
@ConfigurationProperties("micronaut.servlet")
public class MicronautServletConfiguration
extends Object
implements io.micronaut.core.naming.Named, ServletConfiguration
Configuration properties for the Micronaut servlet.
- Since:
- 1.0
- Author:
- graemerocher
-
Field Summary
Fields inherited from interface io.micronaut.servlet.http.ServletConfiguration
DEFAULT
-
Constructor Summary
ConstructorDescriptionMicronautServletConfiguration
(String name, String mapping, io.micronaut.http.server.HttpServerConfiguration serverConfiguration) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionGet the maximum number of threads in the created thread pool.Get the minimum number of threads in the created thread pool.Optional<jakarta.servlet.MultipartConfigElement>
@NonNull String
getName()
boolean
Is async file serving enabled.boolean
Whether to do request processing asynchronously by default (defaults totrue
).boolean
Whether to enable virtual thread support if available.void
setAsyncFileServingEnabled
(boolean enabled) Is async file serving enabled.void
setAsyncSupported
(boolean asyncSupported) Set whether async is supported or not.void
setEnableVirtualThreads
(boolean enableVirtualThreads) Whether virtual threads are enabled.void
setMaxThreads
(Integer maxThreads) Specify the maximum number of threads in the created thread pool.void
setMinThreads
(Integer minThreads) Specify the minimum number of threads in the created thread pool.void
setTestAsyncSupported
(@Nullable Boolean asyncSupported) Deprecated, for removal: This API element is subject to removal in a future version.
-
Field Details
-
PREFIX
The prefix used for configuration.- See Also:
-
-
Constructor Details
-
MicronautServletConfiguration
@ConfigurationInject public MicronautServletConfiguration(@Bindable(defaultValue="micronaut") String name, @Bindable(defaultValue="/*") String mapping, io.micronaut.http.server.HttpServerConfiguration serverConfiguration) Default constructor.- Parameters:
name
- The name of the servletmapping
- The servlet mappingserverConfiguration
- The http server configuration
-
-
Method Details
-
isAsyncSupported
public boolean isAsyncSupported()Description copied from interface:ServletConfiguration
Whether to do request processing asynchronously by default (defaults totrue
).- Specified by:
isAsyncSupported
in interfaceServletConfiguration
- Returns:
- True whether async is enabled
-
setAsyncSupported
public void setAsyncSupported(boolean asyncSupported) Set whether async is supported or not.- Parameters:
asyncSupported
- True if async is supported.
-
setTestAsyncSupported
@Deprecated(forRemoval=true, since="4.8.0") @Property(name="micronaut.server.testing.async") public void setTestAsyncSupported(@Nullable @Nullable Boolean asyncSupported) Deprecated, for removal: This API element is subject to removal in a future version.UsesetAsyncSupported(boolean)
insteadLegacy property to disable async for testing.- Parameters:
asyncSupported
- Is async supported
-
isEnableVirtualThreads
public boolean isEnableVirtualThreads()Description copied from interface:ServletConfiguration
Whether to enable virtual thread support if available.If virtual threads are not available this option does nothing.
- Specified by:
isEnableVirtualThreads
in interfaceServletConfiguration
- Returns:
- True if they should be enabled
-
setEnableVirtualThreads
public void setEnableVirtualThreads(boolean enableVirtualThreads) Whether virtual threads are enabled.- Parameters:
enableVirtualThreads
- True if they are enabled- Since:
- 4.8.0
-
getMapping
- Returns:
- The servlet mapping.
-
getMultipartConfigElement
- Returns:
- The configured multipart element if any
-
getName
- Specified by:
getName
in interfaceio.micronaut.core.naming.Named
-
setAsyncFileServingEnabled
public void setAsyncFileServingEnabled(boolean enabled) Is async file serving enabled.- Parameters:
enabled
- True if it is
-
isAsyncFileServingEnabled
public boolean isAsyncFileServingEnabled()Description copied from interface:ServletConfiguration
Is async file serving enabled.- Specified by:
isAsyncFileServingEnabled
in interfaceServletConfiguration
- Returns:
- True if it is.
-
getMinThreads
Description copied from interface:ServletConfiguration
Get the minimum number of threads in the created thread pool.- Specified by:
getMinThreads
in interfaceServletConfiguration
- Returns:
- The minimum number of threads
-
setMinThreads
Specify the minimum number of threads in the created thread pool.- Parameters:
minThreads
- The minimum number of threads
-
getMaxThreads
Description copied from interface:ServletConfiguration
Get the maximum number of threads in the created thread pool.- Specified by:
getMaxThreads
in interfaceServletConfiguration
- Returns:
- The maximum number of threads
-
setMaxThreads
Specify the maximum number of threads in the created thread pool.- Parameters:
maxThreads
- The maximum number of threads
-
setAsyncSupported(boolean)
instead