Skip to content

Commit 6475cc4

Browse files
committed
Align CustomerApiClientConfig bean injection with consistent naming
- Updated customerApiClient bean to explicitly inject customerRestClient (matching bean name for clarity and avoiding ambiguity with multiple RestClient beans). - Improved readability and future-proofing by keeping method parameter names aligned with defined @bean names.
1 parent 28526a9 commit 6475cc4

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<p align="center">
1111
<img src="docs/images/social-preview.png" alt="Social preview" width="720"/>
1212
<br/>
13-
<em>Social preview banner used for GitHub and sharing</em>
13+
<em>Type-safe API responses without boilerplate — powered by Spring Boot & OpenAPI Generator</em>
1414
</p>
1515

1616
**Type-safe client generation with Spring Boot & OpenAPI using generics.**

customer-service-client/src/main/java/io/github/bsayli/openapi/client/adapter/config/CustomerApiClientConfig.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,18 @@ HttpComponentsClientHttpRequestFactory customerRequestFactory(
5151

5252
@Bean
5353
RestClient customerRestClient(
54-
RestClient.Builder builder, HttpComponentsClientHttpRequestFactory rf) {
55-
return builder.requestFactory(rf).build();
54+
RestClient.Builder builder, HttpComponentsClientHttpRequestFactory customerRequestFactory) {
55+
return builder.requestFactory(customerRequestFactory).build();
5656
}
5757

5858
@Bean
5959
ApiClient customerApiClient(
60-
RestClient restClient, @Value("${customer.api.base-url}") String baseUrl) {
61-
return new ApiClient(restClient).setBasePath(baseUrl);
60+
RestClient customerRestClient, @Value("${customer.api.base-url}") String baseUrl) {
61+
return new ApiClient(customerRestClient).setBasePath(baseUrl);
6262
}
6363

6464
@Bean
65-
CustomerControllerApi customerControllerApi(ApiClient apiClient) {
66-
return new CustomerControllerApi(apiClient);
65+
CustomerControllerApi customerControllerApi(ApiClient customerApiClient) {
66+
return new CustomerControllerApi(customerApiClient);
6767
}
6868
}

customer-service/src/main/java/com/example/demo/common/openapi/OpenApiConfig.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ public class OpenApiConfig {
1919
@Bean
2020
public OpenAPI customerServiceOpenAPI() {
2121
var openapi =
22-
new OpenAPI()
23-
.info(
24-
new Info()
25-
.title(OpenApiConstants.TITLE)
26-
.version(version)
27-
.description(OpenApiConstants.DESCRIPTION));
22+
new OpenAPI()
23+
.info(
24+
new Info()
25+
.title(OpenApiConstants.TITLE)
26+
.version(version)
27+
.description(OpenApiConstants.DESCRIPTION));
2828

2929
if (baseUrl != null && !baseUrl.isBlank()) {
3030
openapi.addServersItem(
31-
new Server().url(baseUrl).description(OpenApiConstants.SERVER_DESCRIPTION));
31+
new Server().url(baseUrl).description(OpenApiConstants.SERVER_DESCRIPTION));
3232
}
3333
return openapi;
3434
}
35-
}
35+
}

0 commit comments

Comments
 (0)