View Javadoc
1   package lv.id.jc.piglatin;
2   
3   import org.springframework.boot.SpringApplication;
4   import org.springframework.boot.autoconfigure.SpringBootApplication;
5   import org.springframework.context.annotation.Bean;
6   
7   import java.net.http.HttpClient;
8   import java.util.concurrent.atomic.AtomicInteger;
9   
10  /**
11   * The main class for the Pig Latin REST application.
12   * This class is responsible for starting the application and defining beans.
13   */
14  @SpringBootApplication
15  public class PigLatinRestApplication {
16  
17      public static void main(String[] args) {
18          SpringApplication.run(PigLatinRestApplication.class, args);
19      }
20  
21      /**
22       * Returns a new instance of HttpClient.
23       *
24       * @return the new instance of HttpClient
25       */
26      @Bean
27      public HttpClient httpClient() {
28          return HttpClient.newHttpClient();
29      }
30  
31     /**
32      * Returns an AtomicInteger object representing a counter for translations.
33      * The counter starts at 0.
34      *
35      * @return the AtomicInteger object representing the translation counter
36      */
37      @Bean
38      public AtomicInteger translationCounter() {
39          return new AtomicInteger(0);
40      }
41  }