Skip to content

Commit 1a4c824

Browse files
committed
Springboot have a exception:NoClassDefFoundError: WebFluxProperties$Format. Fixes #1134.
1 parent 31dae33 commit 1a4c824

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

springdoc-openapi-common/src/main/java/org/springdoc/core/WebConversionServiceProvider.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import java.util.Optional;
44

5-
import org.springframework.boot.autoconfigure.web.format.DateTimeFormatters;
65
import org.springframework.boot.autoconfigure.web.format.WebConversionService;
7-
import org.springframework.boot.autoconfigure.web.reactive.WebFluxProperties.Format;
86
import org.springframework.core.convert.TypeDescriptor;
7+
import org.springframework.format.support.DefaultFormattingConversionService;
8+
import org.springframework.format.support.FormattingConversionService;
99
import org.springframework.lang.Nullable;
1010

1111
/**
@@ -15,9 +15,9 @@
1515
public class WebConversionServiceProvider {
1616

1717
/**
18-
* The Web conversion service.
18+
* The Formatting conversion service.
1919
*/
20-
private final WebConversionService webConversionService;
20+
private final FormattingConversionService formattingConversionService;
2121

2222
/**
2323
* Instantiates a new Web conversion service provider.
@@ -26,12 +26,9 @@ public class WebConversionServiceProvider {
2626
*/
2727
public WebConversionServiceProvider(Optional<WebConversionService> webConversionServiceOptional) {
2828
if (webConversionServiceOptional.isPresent())
29-
this.webConversionService = webConversionServiceOptional.get();
30-
else {
31-
final Format format = new Format();
32-
this.webConversionService = new WebConversionService(new DateTimeFormatters()
33-
.dateFormat(format.getDate()).timeFormat(format.getTime()).dateTimeFormat(format.getDateTime()));
34-
}
29+
this.formattingConversionService = webConversionServiceOptional.get();
30+
else
31+
formattingConversionService = new DefaultFormattingConversionService();
3532
}
3633

3734
/**
@@ -43,6 +40,6 @@ public WebConversionServiceProvider(Optional<WebConversionService> webConversion
4340
*/
4441
@Nullable
4542
public Object convert(@Nullable Object source, TypeDescriptor targetTypeDescriptor) {
46-
return webConversionService.convert(source, targetTypeDescriptor);
43+
return formattingConversionService.convert(source, targetTypeDescriptor);
4744
}
4845
}

0 commit comments

Comments
 (0)