工具类静态方法中调用 访问数据库的service

@Component

@Slf4j

public class CheckPermissionUtil {

            private static final Stringkey ="stcnAuthInfo_ART";

            @Autowired  // 注入

            private UsersServiceuserService;

            // 声明对象

            public static CheckPermissionUtil  commonUtil;

            @PostConstruct // 初始化

            public void init(){

                commonUtil =this;

                commonUtil.userService =this.userService;

            }

}

你可能感兴趣的:(工具类静态方法中调用 访问数据库的service)