-
-
Notifications
You must be signed in to change notification settings - Fork 467
/
SpringDocConfiguration.java
612 lines (567 loc) · 23.1 KB
/
SpringDocConfiguration.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
/*
*
* *
* * *
* * * * Copyright 2019-2022 the original author or authors.
* * * *
* * * * Licensed under the Apache License, Version 2.0 (the "License");
* * * * you may not use this file except in compliance with the License.
* * * * You may obtain a copy of the License at
* * * *
* * * * https://www.apache.org/licenses/LICENSE-2.0
* * * *
* * * * Unless required by applicable law or agreed to in writing, software
* * * * distributed under the License is distributed on an "AS IS" BASIS,
* * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * * * See the License for the specific language governing permissions and
* * * * limitations under the License.
* * *
* *
*
*/
package org.springdoc.core;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.swagger.v3.core.converter.ModelConverter;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.media.ObjectSchema;
import io.swagger.v3.oas.models.media.Schema;
import org.springdoc.api.ErrorMessage;
import org.springdoc.api.OpenApiResourceNotFoundException;
import org.springdoc.core.converters.AdditionalModelsConverter;
import org.springdoc.core.converters.FileSupportConverter;
import org.springdoc.core.converters.ModelConverterRegistrar;
import org.springdoc.core.converters.PageableOpenAPIConverter;
import org.springdoc.core.converters.PolymorphicModelConverter;
import org.springdoc.core.converters.PropertyCustomizingConverter;
import org.springdoc.core.converters.ResponseSupportConverter;
import org.springdoc.core.converters.SchemaPropertyDeprecatingConverter;
import org.springdoc.core.customizers.ActuatorOpenApiCustomizer;
import org.springdoc.core.customizers.ActuatorOperationCustomizer;
import org.springdoc.core.customizers.DataRestDelegatingMethodParameterCustomizer;
import org.springdoc.core.customizers.DelegatingMethodParameterCustomizer;
import org.springdoc.core.customizers.GlobalOpenApiCustomizer;
import org.springdoc.core.customizers.GlobalOperationCustomizer;
import org.springdoc.core.customizers.OpenApiBuilderCustomizer;
import org.springdoc.core.customizers.PropertyCustomizer;
import org.springdoc.core.customizers.ServerBaseUrlCustomizer;
import org.springdoc.core.providers.ActuatorProvider;
import org.springdoc.core.providers.CloudFunctionProvider;
import org.springdoc.core.providers.JavadocProvider;
import org.springdoc.core.providers.ObjectMapperProvider;
import org.springdoc.core.providers.RepositoryRestConfigurationProvider;
import org.springdoc.core.providers.RepositoryRestResourceProvider;
import org.springdoc.core.providers.RouterFunctionProvider;
import org.springdoc.core.providers.SecurityOAuth2Provider;
import org.springdoc.core.providers.SpringCloudFunctionProvider;
import org.springdoc.core.providers.SpringDataWebPropertiesProvider;
import org.springdoc.core.providers.SpringWebProvider;
import org.springdoc.core.providers.WebConversionServiceProvider;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
import org.springframework.boot.actuate.autoconfigure.web.server.ConditionalOnManagementPort;
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementPortType;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.data.web.SpringDataWebProperties;
import org.springframework.boot.autoconfigure.web.format.WebConversionService;
import org.springframework.cloud.function.context.FunctionCatalog;
import org.springframework.cloud.function.web.function.FunctionEndpointInitializer;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.data.domain.Pageable;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.context.request.async.DeferredResult;
import static org.springdoc.core.Constants.SPRINGDOC_DEPRECATING_CONVERTER_ENABLED;
import static org.springdoc.core.Constants.SPRINGDOC_ENABLED;
import static org.springdoc.core.Constants.SPRINGDOC_PAGEABLE_CONVERTER_ENABLED;
import static org.springdoc.core.Constants.SPRINGDOC_POLYMORPHIC_CONVERTER_ENABLED;
import static org.springdoc.core.Constants.SPRINGDOC_SCHEMA_RESOLVE_PROPERTIES;
import static org.springdoc.core.Constants.SPRINGDOC_SHOW_ACTUATOR;
import static org.springdoc.core.Constants.SPRINGDOC_SHOW_SPRING_CLOUD_FUNCTIONS;
import static org.springdoc.core.SpringDocUtils.getConfig;
/**
* The type Spring doc configuration.
* @author bnasslahsen
*/
@Lazy(false)
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name = SPRINGDOC_ENABLED, matchIfMissing = true)
@ConditionalOnWebApplication
public class SpringDocConfiguration {
/**
* The constant BINDRESULT_CLASS.
*/
private static final String BINDRESULT_CLASS = "org.springframework.boot.context.properties.bind.BindResult";
static {
getConfig().replaceWithSchema(ObjectNode.class, new ObjectSchema())
.replaceWithClass(Charset.class, String.class)
.addResponseWrapperToIgnore(DeferredResult.class);
}
/**
* Local spring doc parameter name discoverer local variable table parameter name discoverer.
*
* @return the local variable table parameter name discoverer
*/
@Bean
@Lazy(false)
LocalVariableTableParameterNameDiscoverer localSpringDocParameterNameDiscoverer() {
return new LocalVariableTableParameterNameDiscoverer();
}
/**
* Additional models converter additional models converter.
*
* @param objectMapperProvider the object mapper provider
* @return the additional models converter
*/
@Bean
@Lazy(false)
AdditionalModelsConverter additionalModelsConverter(ObjectMapperProvider objectMapperProvider) {
return new AdditionalModelsConverter(objectMapperProvider);
}
/**
* Property customizing converter property customizing converter.
*
* @param customizers the customizers
* @return the property customizing converter
*/
@Bean
@Lazy(false)
PropertyCustomizingConverter propertyCustomizingConverter(Optional<List<PropertyCustomizer>> customizers) {
return new PropertyCustomizingConverter(customizers);
}
/**
* File support converter file support converter.
*
* @param objectMapperProvider the object mapper provider
* @return the file support converter
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
FileSupportConverter fileSupportConverter(ObjectMapperProvider objectMapperProvider) {
return new FileSupportConverter(objectMapperProvider);
}
/**
* Response support converter response support converter.
*
* @param objectMapperProvider the object mapper provider
* @return the response support converter
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
ResponseSupportConverter responseSupportConverter(ObjectMapperProvider objectMapperProvider) {
return new ResponseSupportConverter(objectMapperProvider);
}
/**
* Schema property deprecating converter schema property deprecating converter.
*
* @return the schema property deprecating converter
*/
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(name = SPRINGDOC_DEPRECATING_CONVERTER_ENABLED, matchIfMissing = true)
@Lazy(false)
SchemaPropertyDeprecatingConverter schemaPropertyDeprecatingConverter() {
return new SchemaPropertyDeprecatingConverter();
}
/**
* Polymorphic model converter polymorphic model converter.
*
* @param objectMapperProvider the object mapper provider
* @return the polymorphic model converter
*/
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(name = SPRINGDOC_POLYMORPHIC_CONVERTER_ENABLED, matchIfMissing = true)
@Lazy(false)
PolymorphicModelConverter polymorphicModelConverter(ObjectMapperProvider objectMapperProvider) {
return new PolymorphicModelConverter(objectMapperProvider);
}
/**
* Open api builder open api builder.
*
* @param openAPI the open api
* @param securityParser the security parser
* @param springDocConfigProperties the spring doc config properties
* @param propertyResolverUtils the property resolver utils
* @param openApiBuilderCustomisers the open api builder customisers
* @param serverBaseUrlCustomisers the server base url customisers
* @param javadocProvider the javadoc provider
* @return the open api builder
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
OpenAPIService openAPIBuilder(Optional<OpenAPI> openAPI,
SecurityService securityParser,
SpringDocConfigProperties springDocConfigProperties,PropertyResolverUtils propertyResolverUtils,
Optional<List<OpenApiBuilderCustomizer>> openApiBuilderCustomisers,
Optional<List<ServerBaseUrlCustomizer>> serverBaseUrlCustomisers, Optional<JavadocProvider> javadocProvider) {
return new OpenAPIService(openAPI, securityParser, springDocConfigProperties, propertyResolverUtils, openApiBuilderCustomisers, serverBaseUrlCustomisers, javadocProvider);
}
/**
* Model converter registrar model converter registrar.
*
* @param modelConverters the model converters
* @return the model converter registrar
*/
@Bean
@Lazy(false)
ModelConverterRegistrar modelConverterRegistrar(Optional<List<ModelConverter>> modelConverters) {
return new ModelConverterRegistrar(modelConverters.orElse(Collections.emptyList()));
}
/**
* Operation builder operation service.
*
* @param parameterBuilder the parameter builder
* @param requestBodyService the request body service
* @param securityParser the security parser
* @param propertyResolverUtils the property resolver utils
* @param javadocProvider the javadoc provider
* @return the operation service
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
OperationService operationBuilder(GenericParameterService parameterBuilder, RequestBodyService requestBodyService,
SecurityService securityParser, PropertyResolverUtils propertyResolverUtils, Optional<JavadocProvider> javadocProvider) {
return new OperationService(parameterBuilder, requestBodyService,
securityParser, propertyResolverUtils, javadocProvider);
}
/**
* Property resolver utils property resolver utils.
*
* @param factory the factory
* @param messageSource the message source
* @param springDocConfigProperties the spring doc config properties
* @return the property resolver utils
*/
@Bean
@Lazy(false)
PropertyResolverUtils propertyResolverUtils(ConfigurableBeanFactory factory, MessageSource messageSource, SpringDocConfigProperties springDocConfigProperties) {
return new PropertyResolverUtils(factory, messageSource, springDocConfigProperties);
}
/**
* Request body builder request body builder.
*
* @param parameterBuilder the parameter builder
* @return the request body builder
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
RequestBodyService requestBodyBuilder(GenericParameterService parameterBuilder) {
return new RequestBodyService(parameterBuilder);
}
/**
* Security parser security parser.
*
* @param propertyResolverUtils the property resolver utils
* @return the security parser
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
SecurityService securityParser(PropertyResolverUtils propertyResolverUtils) {
return new SecurityService(propertyResolverUtils);
}
/**
* Generic return type parser return type parser.
*
* @return the return type parser
*/
@Bean
@Lazy(false)
ReturnTypeParser genericReturnTypeParser() {
return new ReturnTypeParser() {};
}
/**
* Parameter builder generic parameter builder.
*
* @param propertyResolverUtils the property resolver utils
* @param optionalDelegatingMethodParameterCustomizer the optional delegating method parameter customizer
* @param optionalWebConversionServiceProvider the optional web conversion service provider
* @param objectMapperProvider the object mapper provider
* @return the generic parameter builder
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
GenericParameterService parameterBuilder(PropertyResolverUtils propertyResolverUtils,
Optional<DelegatingMethodParameterCustomizer> optionalDelegatingMethodParameterCustomizer,
Optional<WebConversionServiceProvider> optionalWebConversionServiceProvider, ObjectMapperProvider objectMapperProvider) {
return new GenericParameterService(propertyResolverUtils, optionalDelegatingMethodParameterCustomizer,
optionalWebConversionServiceProvider, objectMapperProvider);
}
/**
* Properties resolver for schema open api customiser.
*
* @param propertyResolverUtils the open api property Resolver
* @return the open api customiser
*/
@Bean
@ConditionalOnProperty(SPRINGDOC_SCHEMA_RESOLVE_PROPERTIES)
@Lazy(false)
GlobalOpenApiCustomizer propertiesResolverForSchema(PropertyResolverUtils propertyResolverUtils) {
return openApi -> {
Components components = openApi.getComponents();
Map<String, Schema> schemas = components.getSchemas();
if (!CollectionUtils.isEmpty(schemas))
schemas.values().forEach(schema -> propertyResolverUtils.resolveProperties(schema, Locale.getDefault()));
};
}
/**
* Springdoc bean factory post processor bean factory post processor.
*
* @return the bean factory post processor
*/
@Bean
@Conditional(CacheOrGroupedOpenApiCondition.class)
@ConditionalOnClass(name = BINDRESULT_CLASS)
@Lazy(false)
static BeanFactoryPostProcessor springdocBeanFactoryPostProcessor() {
return new SpringdocBeanFactoryConfigurer();
}
/**
* Springdoc bean factory post processor 2 bean factory post processor.
*
* @return the bean factory post processor
*/
// For spring-boot-1 compatibility
@Bean
@Conditional(CacheOrGroupedOpenApiCondition.class)
@ConditionalOnMissingClass(value = BINDRESULT_CLASS)
@Lazy(false)
static BeanFactoryPostProcessor springdocBeanFactoryPostProcessor2() {
return SpringdocBeanFactoryConfigurer::initBeanFactoryPostProcessor;
}
/**
* Spring doc providers spring doc providers.
*
* @param actuatorProvider the actuator provider
* @param springCloudFunctionProvider the spring cloud function provider
* @param springSecurityOAuth2Provider the spring security o auth 2 provider
* @param repositoryRestResourceProvider the repository rest resource provider
* @param routerFunctionProvider the router function provider
* @param springWebProvider the spring web provider
* @param webConversionServiceProvider the web conversion service provider
* @param objectMapperProvider the object mapper provider
* @return the spring doc providers
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
SpringDocProviders springDocProviders(Optional<ActuatorProvider> actuatorProvider, Optional<CloudFunctionProvider> springCloudFunctionProvider, Optional<SecurityOAuth2Provider> springSecurityOAuth2Provider,
Optional<RepositoryRestResourceProvider> repositoryRestResourceProvider, Optional<RouterFunctionProvider> routerFunctionProvider,
Optional<SpringWebProvider> springWebProvider, Optional<WebConversionServiceProvider> webConversionServiceProvider,
ObjectMapperProvider objectMapperProvider) {
return new SpringDocProviders(actuatorProvider, springCloudFunctionProvider, springSecurityOAuth2Provider, repositoryRestResourceProvider, routerFunctionProvider, springWebProvider, webConversionServiceProvider, objectMapperProvider);
}
/**
* The type Open api resource advice.
* @author bnasslashen
*/
@RestControllerAdvice
@Hidden
class OpenApiResourceAdvice {
/**
* Handle no handler found response entity.
*
* @param e the e
* @return the response entity
*/
@ExceptionHandler(OpenApiResourceNotFoundException.class)
@ResponseStatus(HttpStatus.NOT_FOUND)
public ResponseEntity<ErrorMessage> handleNoHandlerFound(OpenApiResourceNotFoundException e) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new ErrorMessage(e.getMessage()));
}
}
/**
* The type Spring doc web mvc actuator configuration.
* @author bnasslashen
*/
@ConditionalOnClass(WebEndpointProperties.class)
@ConditionalOnProperty(SPRINGDOC_SHOW_ACTUATOR)
static class SpringDocActuatorConfiguration {
/**
* Springdoc bean factory post processor 3 bean factory post processor.
*
* @param groupedOpenApis the grouped open apis
* @return the bean factory post processor
*/
@Bean
@Lazy(false)
@ConditionalOnManagementPort(ManagementPortType.DIFFERENT)
@Conditional(MultipleOpenApiSupportCondition.class)
static BeanFactoryPostProcessor springdocBeanFactoryPostProcessor3(List<GroupedOpenApi> groupedOpenApis) {
return new SpringdocActuatorBeanFactoryConfigurer(groupedOpenApis);
}
/**
* Actuator customizer operation customizer.
*
* @return the operation customizer
*/
@Bean
@Lazy(false)
@ConditionalOnManagementPort(ManagementPortType.SAME)
GlobalOperationCustomizer actuatorCustomizer() {
return new ActuatorOperationCustomizer();
}
/**
* Actuator customizer OpenAPI customiser.
*
* @param webEndpointProperties the web endpoint properties
* @return the OpenAPI customiser
*/
@Bean
@Lazy(false)
@ConditionalOnManagementPort(ManagementPortType.SAME)
GlobalOpenApiCustomizer actuatorOpenApiCustomiser(WebEndpointProperties webEndpointProperties) {
return new ActuatorOpenApiCustomizer(webEndpointProperties);
}
}
/**
* The type Web conversion service configuration.
* @author bnasslashen
*/
@ConditionalOnClass(WebConversionService.class)
static class WebConversionServiceConfiguration {
/**
* Web conversion service provider web conversion service provider.
*
* @param genericConversionServiceList the web conversion service optional
* @return the web conversion service provider
*/
@Bean
@Lazy(false)
WebConversionServiceProvider webConversionServiceProvider(Optional<List<GenericConversionService>> genericConversionServiceList) {
return new WebConversionServiceProvider(genericConversionServiceList);
}
}
/**
* The type Spring doc pageable configuration.
*/
@ConditionalOnClass(Pageable.class)
static class SpringDocPageableConfiguration {
/**
* Pageable open api converter pageable open api converter.
*
* @param objectMapperProvider the object mapper provider
* @return the pageable open api converter
*/
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(name = SPRINGDOC_PAGEABLE_CONVERTER_ENABLED, matchIfMissing = true)
@Lazy(false)
PageableOpenAPIConverter pageableOpenAPIConverter(ObjectMapperProvider objectMapperProvider) {
getConfig().replaceParameterObjectWithClass(org.springframework.data.domain.Pageable.class, org.springdoc.core.converters.models.Pageable.class)
.replaceParameterObjectWithClass(org.springframework.data.domain.PageRequest.class, org.springdoc.core.converters.models.Pageable.class);
return new PageableOpenAPIConverter(objectMapperProvider);
}
/**
* Delegating method parameter customizer delegating method parameter customizer.
*
* @param optionalSpringDataWebPropertiesProvider the optional spring data web properties
* @param optionalRepositoryRestConfiguration the optional repository rest configuration
* @return the delegating method parameter customizer
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
DelegatingMethodParameterCustomizer delegatingMethodParameterCustomizer(Optional<SpringDataWebPropertiesProvider> optionalSpringDataWebPropertiesProvider, Optional<RepositoryRestConfigurationProvider> optionalRepositoryRestConfiguration) {
return new DataRestDelegatingMethodParameterCustomizer(optionalSpringDataWebPropertiesProvider, optionalRepositoryRestConfiguration);
}
}
/**
* The type Spring doc spring data web properties provider.
*/
@ConditionalOnClass(SpringDataWebProperties.class)
static class SpringDocSpringDataWebPropertiesProvider {
/**
* Spring data web properties provider spring data web properties provider.
*
* @param optionalSpringDataWebProperties the optional spring data web properties
* @return the spring data web properties provider
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
SpringDataWebPropertiesProvider springDataWebPropertiesProvider(Optional<SpringDataWebProperties> optionalSpringDataWebProperties) {
return new SpringDataWebPropertiesProvider(optionalSpringDataWebProperties);
}
}
/**
* The type Spring doc repository rest configuration.
*/
@ConditionalOnClass(RepositoryRestConfiguration.class)
static class SpringDocRepositoryRestConfiguration {
/**
* Repository rest configuration provider repository rest configuration provider.
*
* @param optionalRepositoryRestConfiguration the optional repository rest configuration
* @return the repository rest configuration provider
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
RepositoryRestConfigurationProvider repositoryRestConfigurationProvider(Optional<RepositoryRestConfiguration> optionalRepositoryRestConfiguration) {
return new RepositoryRestConfigurationProvider(optionalRepositoryRestConfiguration);
}
}
/**
* The type Spring doc function catalog configuration.
*/
@ConditionalOnClass(FunctionEndpointInitializer.class)
@ConditionalOnProperty(name = SPRINGDOC_SHOW_SPRING_CLOUD_FUNCTIONS, matchIfMissing = true)
static class SpringDocFunctionCatalogConfiguration {
/**
* Spring cloud function provider spring cloud function provider.
*
* @param functionCatalog the function catalog
* @param springDocConfigProperties the spring doc config properties
* @return the spring cloud function provider
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
CloudFunctionProvider springCloudFunctionProvider(Optional<FunctionCatalog> functionCatalog, SpringDocConfigProperties springDocConfigProperties) {
return new SpringCloudFunctionProvider(functionCatalog, springDocConfigProperties);
}
}
/**
* Object mapper provider object mapper provider.
*
* @param springDocConfigProperties the spring doc config properties
* @return the object mapper provider
*/
@Bean
@ConditionalOnMissingBean
@Lazy(false)
ObjectMapperProvider springDocObjectMapperProvider(SpringDocConfigProperties springDocConfigProperties){
return new ObjectMapperProvider(springDocConfigProperties);
}
}