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

com.freemanan.kubernetes.config.util.RefreshContext Maven / Gradle / Ivy

package com.freemanan.kubernetes.config.util;

import org.springframework.cloud.endpoint.event.RefreshEvent;
import org.springframework.context.ApplicationContext;

/**
 * Helper class to get the Spring ApplicationContext and RefreshEvent when refreshing the context.
 *
 * @author Freeman
 */
public record RefreshContext(ApplicationContext applicationContext, RefreshEvent refreshEvent) {
    private static final ThreadLocal holder = new ThreadLocal<>();

    public static void set(RefreshContext refreshContext) {
        holder.set(refreshContext);
    }

    public static RefreshContext get() {
        return holder.get();
    }

    public static void remove() {
        holder.remove();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy