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

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

There is a newer version: 2.0.4
Show newest version
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 HandlerConfiguration {

    private List updateHandlers;

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

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

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy