Skip to content

Commit 0080f57

Browse files
committed
Revert "improve native support"
This reverts commit a7276d9
1 parent a7276d9 commit 0080f57

File tree

3 files changed

+21
-29
lines changed

3 files changed

+21
-29
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ public final class Constants {
101101
public static final String SPRINGDOC_SWAGGER_UI_ENABLED = "springdoc.swagger-ui.enabled";
102102

103103
/**
104-
* The constant SPRING_NATIVE_LISTENER.
104+
* The constant SPRINGDOC_ENABLE_NATIVE_IMAGE_SUPPORT.
105105
*/
106-
public static final String SPRING_NATIVE_LISTENER = "org.springframework.nativex.NativeListener";
106+
public static final String SPRINGDOC_ENABLE_NATIVE_IMAGE_SUPPORT = "springdoc.enable-native-image-support";
107107

108108
/**
109109
* The constant NULL.

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

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import java.util.ArrayList;
2424
import java.util.List;
25-
import java.util.Optional;
2625

2726
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
2827
import org.springframework.boot.context.properties.ConfigurationProperties;
@@ -166,24 +165,15 @@ public class SpringDocConfigProperties {
166165
/**
167166
* The Enable native support.
168167
*/
169-
protected Boolean enableNativeImageSupport;
170-
171-
private final Optional<SpringDocHints> springDocHintsOptional;
172-
173-
public SpringDocConfigProperties(Optional<SpringDocHints> springDocHintsOptional) {
174-
this.springDocHintsOptional = springDocHintsOptional;
175-
}
168+
protected boolean enableNativeImageSupport;
176169

177170
/**
178171
* Is enable native image support boolean.
179172
*
180173
* @return the boolean
181174
*/
182175
public boolean isEnableNativeImageSupport() {
183-
if (enableNativeImageSupport != null)
184-
return enableNativeImageSupport;
185-
else
186-
return springDocHintsOptional.isPresent();
176+
return enableNativeImageSupport;
187177
}
188178

189179
/**
@@ -957,7 +947,7 @@ public GroupConfig() {
957947
*/
958948
public GroupConfig(String group, List<String> pathsToMatch, List<String> packagesToScan,
959949
List<String> packagesToExclude, List<String> pathsToExclude,
960-
List<String> producesToMatch, List<String> consumesToMatch, List<String> headersToMatch) {
950+
List<String> producesToMatch,List<String> consumesToMatch,List<String> headersToMatch) {
961951
this.pathsToMatch = pathsToMatch;
962952
this.pathsToExclude = pathsToExclude;
963953
this.packagesToExclude = packagesToExclude;

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

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,18 @@
6060
import io.swagger.v3.oas.models.security.Scopes;
6161
import io.swagger.v3.oas.models.servers.ServerVariables;
6262

63-
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
63+
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
6464
import org.springframework.context.annotation.Configuration;
6565
import org.springframework.context.annotation.PropertySource;
6666
import org.springframework.nativex.hint.AccessBits;
6767
import org.springframework.nativex.hint.ProxyHint;
6868
import org.springframework.nativex.hint.ResourceHint;
6969
import org.springframework.nativex.hint.TypeHint;
7070

71-
import static org.springdoc.core.Constants.SPRING_NATIVE_LISTENER;
71+
import static org.springdoc.core.Constants.SPRINGDOC_ENABLE_NATIVE_IMAGE_SUPPORT;
7272

7373
@ProxyHint(typeNames = "javax.servlet.http.HttpServletRequest")
74+
7475
@ProxyHint(typeNames = { "org.springframework.web.bind.annotation.RestController", "org.springframework.core.annotation.SynthesizedAnnotation" })
7576
@ProxyHint(typeNames = { "org.springframework.stereotype.Controller", "org.springframework.core.annotation.SynthesizedAnnotation" })
7677
@ProxyHint(typeNames = { "org.springframework.web.bind.annotation.SessionAttribute", "org.springframework.core.annotation.SynthesizedAnnotation" })
@@ -86,23 +87,25 @@
8687
@ProxyHint(typeNames = { "org.springframework.web.bind.annotation.PatchMapping", "org.springframework.core.annotation.SynthesizedAnnotation" })
8788
@ProxyHint(typeNames = { "org.springframework.web.bind.annotation.DeleteMapping", "org.springframework.core.annotation.SynthesizedAnnotation" })
8889
@ProxyHint(typeNames = { "org.springframework.web.bind.annotation.ControllerAdvice", "org.springframework.core.annotation.SynthesizedAnnotation" })
89-
@ProxyHint(typeNames = { "org.springframework.web.bind.annotation.RequestParam", "org.springframework.core.annotation.SynthesizedAnnotation" })
90-
@ProxyHint(typeNames = { "org.springframework.web.bind.annotation.RequestHeader", "org.springframework.core.annotation.SynthesizedAnnotation" })
91-
@ProxyHint(typeNames = { "org.springframework.web.bind.annotation.RequestBody", "org.springframework.core.annotation.SynthesizedAnnotation" })
92-
@ProxyHint(typeNames = { "org.springframework.web.bind.annotation.PathVariable", "org.springframework.core.annotation.SynthesizedAnnotation" })
93-
@ProxyHint(typeNames = { "org.springframework.web.bind.annotation.ModelAttribute", "org.springframework.core.annotation.SynthesizedAnnotation" })
94-
@ProxyHint(typeNames = { "org.springframework.stereotype.Controller", "org.springframework.core.annotation.SynthesizedAnnotation" })
95-
@ProxyHint(typeNames = { "org.springframework.web.bind.annotation.ControllerAdvice", "org.springframework.core.annotation.SynthesizedAnnotation" })
90+
@ProxyHint(typeNames = {"org.springframework.web.bind.annotation.RequestParam", "org.springframework.core.annotation.SynthesizedAnnotation"})
91+
@ProxyHint(typeNames = {"org.springframework.web.bind.annotation.RequestHeader", "org.springframework.core.annotation.SynthesizedAnnotation"})
92+
@ProxyHint(typeNames = {"org.springframework.web.bind.annotation.RequestBody", "org.springframework.core.annotation.SynthesizedAnnotation"})
93+
@ProxyHint(typeNames = {"org.springframework.web.bind.annotation.PathVariable", "org.springframework.core.annotation.SynthesizedAnnotation"})
94+
@ProxyHint(typeNames = {"org.springframework.web.bind.annotation.ModelAttribute", "org.springframework.core.annotation.SynthesizedAnnotation"})
95+
@ProxyHint(typeNames = {"org.springframework.stereotype.Controller", "org.springframework.core.annotation.SynthesizedAnnotation"})
96+
@ProxyHint(typeNames = {"org.springframework.web.bind.annotation.ControllerAdvice", "org.springframework.core.annotation.SynthesizedAnnotation"})
9697

9798
@TypeHint(typeNames = { "org.springdoc.core.CacheOrGroupedOpenApiCondition$OnCacheDisabled", "io.swagger.v3.oas.models.parameters.Parameter$StyleEnum",
98-
"io.swagger.v3.oas.models.security.SecurityScheme$In", "io.swagger.v3.oas.models.security.SecurityScheme$Type",
99+
"io.swagger.v3.oas.models.security.SecurityScheme$In" , "io.swagger.v3.oas.models.security.SecurityScheme$Type",
99100
"org.springdoc.core.CacheOrGroupedOpenApiCondition$OnMultipleOpenApiSupportCondition" }, access = AccessBits.ALL)
100-
@TypeHint(types = { Constants.class, ModelConverter.class, ModelConverters.class })
101+
102+
@TypeHint(types = { Constants.class, ModelConverter.class , ModelConverters.class})
101103
@TypeHint(types = { SecurityRequirements.class, SecurityRequirement.class, ApiResponses.class, Callbacks.class, PropertySource.class, ExternalDocumentation.class, Hidden.class,
102104
Operation.class, Parameter.class, Callbacks.class, Extension.class, ExtensionProperty.class, Header.class, Link.class, LinkParameter.class,
103105
ArraySchema.class, Content.class, DiscriminatorMapping.class, Encoding.class, ExampleObject.class, Schema.class, RequestBody.class, ApiResponse.class,
104-
Info.class, Server.class, ServerVariable.class, OpenAPIDefinition.class, Tag.class, SecuritySchemes.class, SecurityScheme.class, SecuritySchemeType.class,
106+
Info.class, Server.class, ServerVariable.class, OpenAPIDefinition.class, Tag.class, SecuritySchemes.class, SecurityScheme.class, SecuritySchemeType.class,
105107
OAuthFlow.class, OAuthFlows.class, OAuthScope.class })
108+
106109
@TypeHint(types = {
107110
SpecFilter.class,
108111
MediaType.class,
@@ -150,7 +153,6 @@
150153
})
151154

152155
@ResourceHint(patterns = "springdoc.swagger-ui.config")
153-
154156
@Configuration(proxyBeanMethods = false)
155-
@ConditionalOnClass(name = SPRING_NATIVE_LISTENER)
157+
@ConditionalOnProperty(name = SPRINGDOC_ENABLE_NATIVE_IMAGE_SUPPORT, havingValue = "true")
156158
public class SpringDocHints {}

0 commit comments

Comments
 (0)