Class OpenApiSecurityDefaultsEnvironmentPostProcessor
java.lang.Object
tech.riemann.nif.openapi.OpenApiSecurityDefaultsEnvironmentPostProcessor
- All Implemented Interfaces:
org.springframework.boot.EnvironmentPostProcessor, org.springframework.core.Ordered
public class OpenApiSecurityDefaultsEnvironmentPostProcessor
extends Object
implements org.springframework.boot.EnvironmentPostProcessor, org.springframework.core.Ordered
OpenAPI / Swagger 安全默认兜底(P1-12)。
不依赖任何配置文件,在 Environment 准备阶段注入低优先级默认值:
nif.openapi.enabled=false—— 总开关默认关闭springdoc.api-docs.enabled=${nif.openapi.enabled}—— 镜像开关,端点默认关闭springdoc.swagger-ui.enabled=${nif.openapi.enabled}—— 同上
@ConditionalOnProperty(springdoc.api-docs.enabled, matchIfMissing=true)
控制,
读取的是 Environment 属性而非 Properties Bean 的字段默认值;因此必须在
Environment 层注入默认
false 才能真正默认关闭。用户显式设置 nif.openapi.enabled=true(或更高优先级的
PropertySource)
即可覆盖并开启全部端点。- Author:
- Kerbores(kerbores@riemann.tech)
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetOrder()voidpostProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.boot.SpringApplication application)
-
Constructor Details
-
OpenApiSecurityDefaultsEnvironmentPostProcessor
public OpenApiSecurityDefaultsEnvironmentPostProcessor()
-
-
Method Details
-
postProcessEnvironment
public void postProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.boot.SpringApplication application) - Specified by:
postProcessEnvironmentin interfaceorg.springframework.boot.EnvironmentPostProcessor
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-