Localstorage.java 483 Bytes
package com.meishu.util;

import org.springframework.web.bind.annotation.RestController;

@RestController
public class Localstorage {

    private static final ThreadLocal<Object> local = ThreadLocal.withInitial(() -> null);

    public static void setUser(Object admin) {
        Localstorage.local.set(admin);
    }

    public static Object getUser() {
        return Localstorage.local.get();
    }

    public static void remove() {
        Localstorage.local.remove();
    }
}