JDK1.6的單向加密:
BASE64Encoder base64Encoder = new BASE64Encoder();
String newStr =java.util.Base64.getEncoder().encodeToString(srcStr.getBytes());
JDK1.8的單向加密:
String newStr = Base64.getEncoder().encodeToString(md5Bytes);
BASE64Encoder base64Encoder = new BASE64Encoder();
String newStr =java.util.Base64.getEncoder().encodeToString(srcStr.getBytes());
JDK1.8的單向加密:
String newStr = Base64.getEncoder().encodeToString(md5Bytes);
2018-12-25
String otpCode = RandomStringUtils.randomNumeric(6);
用apache的commons工具包也可以獲取隨機(jī)數(shù)
用apache的commons工具包也可以獲取隨機(jī)數(shù)
2018-12-24
@麻了一一一
你好,的確,對應(yīng)沒有走到controller層面內(nèi)的錯(cuò)誤補(bǔ)獲不到,可以采用controlleradvice注解另外定義一個(gè)類,然后實(shí)現(xiàn)一個(gè)方法,類似于這樣
@ControllerAdvice
public class Test {
@ExceptionHandler(value = Exception.class)
@ResponseBody
public CommonReturnType error(HttpServletRequest request, HttpServletResponse response, Exception e)
}
你好,的確,對應(yīng)沒有走到controller層面內(nèi)的錯(cuò)誤補(bǔ)獲不到,可以采用controlleradvice注解另外定義一個(gè)類,然后實(shí)現(xiàn)一個(gè)方法,類似于這樣
@ControllerAdvice
public class Test {
@ExceptionHandler(value = Exception.class)
@ResponseBody
public CommonReturnType error(HttpServletRequest request, HttpServletResponse response, Exception e)
}
2018-12-22
在控制器中 接受參數(shù) 為什么不直接用類接受 而一個(gè)一個(gè)的寫參數(shù) 這樣好繁雜
2018-12-22
public CommonReturnType getUser(@RequestParam(name = "id")Integer id)運(yùn)行沒有問題。
但是通常寫:@RequestParam(value = "id")Integer id
但是通常寫:@RequestParam(value = "id")Integer id
2018-12-21