# About

На моем [Github](https://github.com/IkeMurami/zdocker-env/tree/master/JVM) можно найти маленькие примеры приложений на Spring Framework.

Spring: <https://spring.io/>\
Tutorial: <https://kotlinlang.org/docs/jvm-spring-boot-restful.html>

## Примерная зависимость компонентов:

```
Configurator — инициализирует HttpClient, Service, Controller, ...
Controller — принимает Service, обрабатывает API вызовы и передает сервису
Service — уровень логики, берет на себя таски в фоне
```

## В коде

### Configurator

```java
// ...

@Configurator
public class SomeContextConfigurator {

    @Bean
    public SomeController someController( ... ) {
        return new SomeController(someService, ...);
    }

    @Bean
    public SomeService someService(
        ...
    ) {
        return new SomeService(...);
    }

    @Bean
    public CloseableHttpClient httpClient(
        ...
    ) {
        ApacheHttpClientUtils.Builder builder = ApacheHttpClientUtils.Builder.create()
            .multiThreaded()
            . // ...
        
        return builder.build();
    }
}

// ...
```

### Controller

```java
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping(value = "/some")
public class SomeController {

    private final SomeService someService;

    public SomeController(
        SomeService someService
    ) {
        this.someService = someService;
    }

    @RequestMapping(value = "send", method = RequestMethod.POST)
    public SomeResult someAction(
        @RequestParam("post_param") String postParam
    ) {
        // ...
        someService.someAction(postParam);
        // ...
    }

}
```

### Service

Interface

```java
public interface SomeService {

    SomeResult someAction(String postParam);

}
```

Impl

```java
public class ConnectorSendSmsServiceImpl implements ConnectorSendSmsService {

    // ...
    
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://appsecurity.gitbook.io/devops/ppc/ppc-langs/backend/jvm/frameworks/spring-framework/about.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
