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

io.github.zhyshko.core.configuration.RouterConfiguration Maven / Gradle / Ivy

package io.github.zhyshko.core.configuration;

import io.github.zhyshko.core.router.UpdateRouter;
import io.github.zhyshko.core.util.UpdateType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@Component
public class RouterConfiguration {

    private List updateRouters;

    @Bean
    public Map getUpdateRouters() {
        return updateRouters.stream()
                .collect(Collectors.toMap(UpdateRouter::getType, Function.identity()));
    }

    @Autowired
    public void setUpdateHandlers(List updateRouters) {
        this.updateRouters = updateRouters;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy