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
FieldsFields inherited from interface io.micronaut.servlet.http.ServletConfiguration
DEFAULT -
Constructor Summary
ConstructorsConstructorDescriptionMicronautServletConfiguration(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 StringgetName()booleanIs async file serving enabled.booleanWhether to do request processing asynchronously by default (defaults totrue).booleanWhether to enable virtual thread support if available.voidsetAsyncFileServingEnabled(boolean enabled) Is async file serving enabled.voidsetAsyncSupported(boolean asyncSupported) Set whether async is supported or not.voidsetEnableVirtualThreads(boolean enableVirtualThreads) Whether virtual threads are enabled.voidsetMaxThreads(Integer maxThreads) Specify the maximum number of threads in the created thread pool.voidsetMinThreads(Integer minThreads) Specify the minimum number of threads in the created thread pool.voidsetTestAsyncSupported(@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:ServletConfigurationWhether to do request processing asynchronously by default (defaults totrue).- Specified by:
isAsyncSupportedin 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:ServletConfigurationWhether to enable virtual thread support if available.If virtual threads are not available this option does nothing.
- Specified by:
isEnableVirtualThreadsin 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:
getNamein 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:ServletConfigurationIs async file serving enabled.- Specified by:
isAsyncFileServingEnabledin interfaceServletConfiguration- Returns:
- True if it is.
-
getMinThreads
Description copied from interface:ServletConfigurationGet the minimum number of threads in the created thread pool.- Specified by:
getMinThreadsin 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:ServletConfigurationGet the maximum number of threads in the created thread pool.- Specified by:
getMaxThreadsin 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