Class WebClientConfig

java.lang.Object
gr.unipi.weather_app.configuration.WebClientConfig

@Configuration public class WebClientConfig extends Object
Configuration class for setting up a WebClient bean.

This class is responsible for creating a WebClient instance that will be used to make HTTP requests to the weather API. The base URL for the API is injected from the application's properties.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
    The base URL for the weather API, injected from application properties.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.web.reactive.function.client.WebClient
    Creates and configures a WebClient bean.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • baseUrl

      @Value("${weather.api.base-url}") private String baseUrl
      The base URL for the weather API, injected from application properties.
  • Constructor Details

    • WebClientConfig

      public WebClientConfig()
  • Method Details

    • webClient

      @Bean public org.springframework.web.reactive.function.client.WebClient webClient()
      Creates and configures a WebClient bean.

      This WebClient instance is built using the provided base URL and can be used throughout the application for making asynchronous HTTP requests.

      Returns:
      a configured WebClient instance