Blame view

Localstorage.java 484 Bytes
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
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();
    }
}