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

com.spring.boxes.gateway.refresh.GatewayRoutesRefresher Maven / Gradle / Ivy

The newest version!
package com.spring.boxes.gateway.refresh;

import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.gateway.event.RefreshRoutesEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;

@Slf4j
@NoArgsConstructor
public class GatewayRoutesRefresher implements ApplicationEventPublisherAware {

    private ApplicationEventPublisher applicationEventPublisher;

    public GatewayRoutesRefresher(ApplicationEventPublisher applicationEventPublisher) {
        this.applicationEventPublisher = applicationEventPublisher;
        this.setApplicationEventPublisher(applicationEventPublisher);
    }

    @Override
    public void setApplicationEventPublisher(@NonNull ApplicationEventPublisher applicationEventPublisher) {
        this.applicationEventPublisher = applicationEventPublisher;
    }

    public void refreshRoutes() {
        applicationEventPublisher.publishEvent(new RefreshRoutesEvent(this));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy