Localstorage.java 484 Bytes
package com.subsidy.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();
    }
}