All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.common.TokenContextHolder.ftl Maven / Gradle / Ivy

There is a newer version: 2.0.4
Show newest version
package ${packageName}.common.context;

import lombok.extern.slf4j.Slf4j;

/**
 * @author Co.
 * @name TokenContextHolder
 * @date 2023/2/22 17:31
 */
@Slf4j
public class TokenContextHolder {


    private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>();

    /**
     *
     */
    public static void setToken(String token) {
        CONTEXT_HOLDER.set(token);
    }

    /**
     *
     */
    public static String getToken() {
        return CONTEXT_HOLDER.get();
    }

    /**
     *
     */
    public static void clearToken() {
        CONTEXT_HOLDER.remove();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy