Skip to content

support spring RequestMapping String[] params() #1726

Closed
@sdandroid

Description

@sdandroid
  @Operation(summary = "test")
  @GetMapping(value = "/api/test", params = "action=test")
  @ResponseBody
  public void test(String code) {
	
  }
  @Operation(summary = "test1")
  @GetMapping(value = "/api/test", params = "action=test1")
  @ResponseBody
  public void test1(String code) {
	
  }

/api/test?action=test  ==>  call  test function
/api/test?action=test1 ==> call  test1 function
/api/test  ==>    cannot call any function

spring doc

	/**
	 * The parameters of the mapped request, narrowing the primary mapping.
	 * <p>Same format for any environment: a sequence of "myParam=myValue" style
	 * expressions, with a request only mapped if each such parameter is found
	 * to have the given value. Expressions can be negated by using the "!=" operator,
	 * as in "myParam!=myValue". "myParam" style expressions are also supported,
	 * with such parameters having to be present in the request (allowed to have
	 * any value). Finally, "!myParam" style expressions indicate that the
	 * specified parameter is <i>not</i> supposed to be present in the request.
	 * <p><b>Supported at the type level as well as at the method level!</b>
	 * When used at the type level, all method-level mappings inherit this
	 * parameter restriction.
	 */
	String[] params() default {};

Now the method cannot be called on the swagger ui without generating the parameters of the param.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions