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 aJsonExceptionHandler
bean for handling JSON exceptions.com.fasterxml.jackson.databind.ObjectMapper
Creates and returns anObjectMapper
bean for JSON object mapping.Creates and returns anErrorResponseCreator
bean for preparing error responses.Creates and returns aTomcatServletWebServerFactory
bean for configuring the embedded Tomcat web server.
-
Field Details
-
serverProperties
-
-
Constructor Details
-
WebServerConfiguration
public WebServerConfiguration()
-
-
Method Details
-
tomcatServletWebServerFactory
Creates and returns aTomcatServletWebServerFactory
bean for configuring the embedded Tomcat web server. The port and context path are obtained from theServerProperties
bean.- Returns:
- a configured instance of
TomcatServletWebServerFactory
- See Also:
-
objectMapper
public com.fasterxml.jackson.databind.ObjectMapper objectMapper()Creates and returns anObjectMapper
bean for JSON object mapping.- Returns:
- a configured instance of
ObjectMapper
-
prepareErrorResponseCreator
Creates and returns anErrorResponseCreator
bean for preparing error responses.- Returns:
- a new instance of
ErrorResponseCreator
- See Also:
-
jsonExceptionHandler
Creates and returns aJsonExceptionHandler
bean for handling JSON exceptions. This bean is configured with anObjectMapper
andServerProperties
.- Returns:
- a new instance of
JsonExceptionHandler
- See Also:
-