Package com.bobocode.bring.web.server
Class WebServerConfiguration
java.lang.Object
com.bobocode.bring.web.server.WebServerConfiguration
Configuration class for setting up and customizing the web server and related beans.
The WebServerConfiguration class is responsible for defining beans related
to the embedded web server, object mapping, error handling.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates and returns aJsonExceptionHandlerbean for handling JSON exceptions.com.fasterxml.jackson.databind.ObjectMapperCreates and returns anObjectMapperbean for JSON object mapping.Creates and returns anErrorResponseCreatorbean for preparing error responses.Creates and returns aTomcatServletWebServerFactorybean for configuring the embedded Tomcat web server.
-
Field Details
-
serverProperties
-
-
Constructor Details
-
WebServerConfiguration
public WebServerConfiguration()
-
-
Method Details
-
tomcatServletWebServerFactory
Creates and returns aTomcatServletWebServerFactorybean for configuring the embedded Tomcat web server. The port and context path are obtained from theServerPropertiesbean.- Returns:
- a configured instance of
TomcatServletWebServerFactory - See Also:
-
objectMapper
public com.fasterxml.jackson.databind.ObjectMapper objectMapper()Creates and returns anObjectMapperbean for JSON object mapping.- Returns:
- a configured instance of
ObjectMapper
-
prepareErrorResponseCreator
Creates and returns anErrorResponseCreatorbean for preparing error responses.- Returns:
- a new instance of
ErrorResponseCreator - See Also:
-
jsonExceptionHandler
Creates and returns aJsonExceptionHandlerbean for handling JSON exceptions. This bean is configured with anObjectMapperandServerProperties.- Returns:
- a new instance of
JsonExceptionHandler - See Also:
-