Class WeatherAppApplication

java.lang.Object
gr.unipi.weather_app.WeatherAppApplication

@SpringBootApplication public class WeatherAppApplication extends Object
The main entry point for the Weather Application.

This class is responsible for bootstrapping the Spring Boot application and providing a command-line interface (CLI) for interacting with the weather services.

  • Constructor Details

    • WeatherAppApplication

      public WeatherAppApplication()
  • Method Details

    • main

      public static void main(String[] args)
      The main method that starts the Spring Boot application.
      Parameters:
      args - command-line arguments (not used)
    • runConsole

      @Bean org.springframework.boot.CommandLineRunner runConsole(WeatherService weatherService)
      Provides a command-line interface (CLI) for interacting with the weather application.

      Users can request weather data, fetch statistical reports, and exit the program.

      Parameters:
      weatherService - the service handling weather-related operations
      Returns:
      a CommandLineRunner that executes the menu-driven interaction
    • getWeatherData

      private void getWeatherData(Scanner scanner, WeatherService weatherService)
      Fetches and displays real-time weather data for a specified city.
      Parameters:
      scanner - the Scanner object to read user input
      weatherService - the service used to fetch weather data
    • getAverageWeatherForCity

      private void getAverageWeatherForCity(Scanner scanner, WeatherService weatherService)
      Retrieves and displays the average weather data for a specified city.
      Parameters:
      scanner - the Scanner object to read user input
      weatherService - the service used to retrieve weather statistics
    • getAverageWeatherForLastDays

      private void getAverageWeatherForLastDays(Scanner scanner, WeatherService weatherService)
      Retrieves and displays the average weather statistics for the last X days.
      Parameters:
      scanner - the Scanner object to read user input
      weatherService - the service used to retrieve historical weather data