@Component
public class JwtUtil {
/**
* 静态方法调用非静态接口层(Service层)
*/
public static JwtUtil jwtUtil; //声明对象
@PostConstruct //初始化
public void init() {
jwtUtil = this;
jwtUtil.userService = this.userService;
}
@Autowired //注入
UserService userService;
public static boolean checkSign(String token) {
...
String username= jwtUtil.userService.getUsernameById(userId);
...
}
java 静态(static)方法中调用接口(Service层)
猜你喜欢
转载自blog.csdn.net/lorogy/article/details/110438779
今日推荐
周排行