@RequestMapping("/test")
public String test() {
//直接将目标文件读成inputstream this指当前类的实例对象
InputStream ins = this.getClass().getClassLoader().getResourceAsStream("userInfo.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader(ins));
String line = null;
// 一次读入一行,直到读入null为文件结束
try {
while ((line = reader.readLine()) != null) {
String[] split = line.split("\\:");
String phone = split[0];
String pwd = split[1];
String deviceId = split[2];
String encodePwd = new String(Base64.getEncoder().encode(pwd.getBytes()));
System.out.println(phone+"=="+pwd+"=="+deviceId);
if("11111110002".equals(phone) || "10074435291".equals(phone)){
doLogin(phone,encodePwd,deviceId);
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e1) {
}
}
}
return "It works2!";
}