When using restful style to verify whether the user name exists, all normal names can be verified, but when verifying whether the email address exists, no parameters can be accepted. The code is as follows
@ApiOperation(value = "查询用户名是否存在", notes = "查询用户名是否存在")
@GetMapping("/check/{userName}")
public BaseResult checkUserName(@PathVariable("userName") String userName) {
return appUserService.checkUserName(userName);
}
The following are test pictures
typecho2017-06-28 09:27:42
Need to modify the default url matching rules of spring boot
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setUseSuffixPatternMatch(false);
}
configurer.setUseSuffixPatternMatch(false) means that the URL exposed by the system will not recognize and match the .* suffix.
In this code, it means that Spring will pass sunny.cn to the Controller as a {userName} parameter.
过去多啦不再A梦2017-06-28 09:27:42
You can also use expressions
@RequestMapping(value = "/{userName:.+}",method = RequestMethod.GET)
public String query(@PathVariable("userName") String userName){
return username;
}