Custom Parameter Data
This paper describes how to customize the extension of org.apache.shenyu.plugin.base.condition.data.ParameterData.
- Create a new project and introduce the following dependencies:
<dependencies> <dependency> <groupId>org.apache.shenyu</groupId> <artifactId>shenyu-plugin-base</artifactId> <version>${project.version}</version> </dependency></dependencies>- Create a new class
CustomParameterData, implementsorg.apache.shenyu.plugin.base.condition.data.ParameterData, add annotationorg.apache.shenyu.spi.Join.
/** * This is custom parameter data. */@Joinpublic class CustomParameterData implements ParameterData { @Override public String builder(final String paramName, final ServerWebExchange exchange) { // custom parameter data }}- In the project's META-INF/services directory, create
org.apache.shenyu.plugin.base.condition.data.ParameterDatafile, add key-value as following:
${spi name} = ${custom class path}${spi name} represents the name of spi and ${custom class path} represents the fully qualified name of the class. Such as:
custom=xxx.xxx.xxx.CustomParameterDataPackage the project and copy it to the
liborext-libdirectory of the gateway (bootstrap-bin).In the
Apache ShenYugateway management system --> BasicConfig --> Dictionary, find the dictionary code asPARAM_TYPE, add a new piece of data, pay attention to the dictionary name:${spi name}.

DictionaryType:
paramType;DictionaryCode:
PARAM_TYPE;DictionaryName:
${spi name}, input your custom spi name;DictionaryValue: When used, the value of the drop-down box, do not repeat with the existing;
DictionaryDescribe: desc your custom match strategy;
Sort: to sort;
Status: open or close.
- When adding selectors or rules, you can use custom parameter data:
