Skip to content

Commit

Permalink
springdoc-openapi-webflux-ui v1.6.7 + spring actuator + spring cloud …
Browse files Browse the repository at this point in the history
…crashes at startup. Fixes #1617.
  • Loading branch information
bnasslahsen committed Apr 20, 2022
1 parent 160d3bc commit d2e71dc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,13 @@ static class WebConversionServiceConfiguration {
/**
* Web conversion service provider web conversion service provider.
*
* @param mvcConversionService the web conversion service optional
* @param genericConversionServiceList the web conversion service optional
* @return the web conversion service provider
*/
@Bean
@Lazy(false)
WebConversionServiceProvider webConversionServiceProvider(Optional<GenericConversionService> mvcConversionService) {
return new WebConversionServiceProvider(mvcConversionService);
WebConversionServiceProvider webConversionServiceProvider(Optional<List<GenericConversionService>> genericConversionServiceList) {
return new WebConversionServiceProvider(genericConversionServiceList);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.springdoc.core.providers;

import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;
import java.util.Optional;

Expand All @@ -12,6 +13,7 @@
import org.springframework.core.convert.converter.GenericConverter.ConvertiblePair;
import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.format.support.DefaultFormattingConversionService;
import org.springframework.format.support.FormattingConversionService;
import org.springframework.lang.Nullable;

/**
Expand All @@ -29,17 +31,24 @@ public class WebConversionServiceProvider {
/**
* The Formatting conversion service.
*/
private final GenericConversionService formattingConversionService;
private GenericConversionService formattingConversionService;

/**
* Instantiates a new Web conversion service provider.
*
* @param webConversionServiceOptional the web conversion service optional
*/
public WebConversionServiceProvider(Optional<GenericConversionService> webConversionServiceOptional) {
if (webConversionServiceOptional.isPresent())
this.formattingConversionService = webConversionServiceOptional.get();
else
public WebConversionServiceProvider(Optional<List<GenericConversionService>> webConversionServiceOptional) {
if (webConversionServiceOptional.isPresent()) {
List<GenericConversionService> conversionServiceList = webConversionServiceOptional.get();
for (GenericConversionService genericConversionService : conversionServiceList) {
if (genericConversionService instanceof FormattingConversionService) {
this.formattingConversionService = genericConversionService;
break;
}
}
}
if (formattingConversionService == null)
formattingConversionService = new DefaultFormattingConversionService();
}

Expand Down

0 comments on commit d2e71dc

Please sign in to comment.