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

com.github.lontime.extspring.components.RedissonComponentExt Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package com.github.lontime.extspring.components;

import java.util.stream.Collectors;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;

import com.github.lontime.base.commonj.components.ComponentInterfaceHelper;
import com.github.lontime.extredisson.RedissonInstance;
import com.github.lontime.extredisson.consumer.RemoteService;
import com.github.lontime.extredisson.listener.StreamCallbackInterface;

/**
 * RedissonComponentExt.
 * @author lontime
 * @since 1.0
 */
public class RedissonComponentExt implements InitializingBean {

    private ObjectProvider streamCallbackInterfaces;

    private ObjectProvider remoteServices;

    @Autowired
    public void setStreamCallbackInterfaces(ObjectProvider streamCallbackInterfaces) {
        this.streamCallbackInterfaces = streamCallbackInterfaces;
    }

    @Autowired
    public void setRemoteServices(ObjectProvider remoteServices) {
        this.remoteServices = remoteServices;
    }

    @Override
    public void afterPropertiesSet() {
        ComponentInterfaceHelper.register(streamCallbackInterfaces.stream()
                .filter(s -> s.getClazz() == StreamCallbackInterface.class).collect(Collectors.toList()));
        ComponentInterfaceHelper.register(remoteServices.stream()
                        .filter(s -> s.getClazz() == RemoteService.class).collect(Collectors.toList()));
        RedissonInstance.get();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy