一、httpservletrequest 写成httpservlet出现bug
会出现提示“Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [javax.servlet.http.HttpServlet]: Is it an abstract class?”
将原来写错的部分改为HttpServletrequest就行
package com.server.service;
import com.server.pojo.Admin;
import com.baomidou.mybatisplus.extension.service.IService;
import com.server.pojo.ResBean;
import javax.servlet.http.HttpServletRequest;
public interface IAdminService extends IService<Admin> {
/**
* 登录之后返回token
* @param username
* @param password
* @param request
* @return
*/
ResBean login(String username, String password, HttpServletRequest request);
/**
* 根据用户名获取用户
* @param username
* @return
*/
Admin getAdminByUserName(String username);
}
二、Swagger接口文档测试思路
1)登录,拿到token
2)在swagger Authorize里边加上相应参数 tokenHead token
3)保存完之后访问接口都会携带这个令牌