com.github.lontime.extspring.components.HttpComponentExt Maven / Gradle / Ivy
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.exthttp.HttpInstance;
import com.github.lontime.exthttp.container.HttpInterceptorInterface;
import com.github.lontime.exthttp.container.HttpRouteInterface;
/**
* CopperComponentExt.
* @author lontime
* @since 1.0
*/
public class HttpComponentExt implements InitializingBean {
private ObjectProvider routes;
private ObjectProvider interceptors;
@Autowired
public void setRoutes(ObjectProvider routes) {
this.routes = routes;
}
@Autowired
public void setInterceptors(ObjectProvider interceptors) {
this.interceptors = interceptors;
}
@Override
public void afterPropertiesSet() {
ComponentInterfaceHelper.register(routes.stream()
.filter(s -> s.getClazz() == HttpRouteInterface.class)
.collect(Collectors.toList()));
ComponentInterfaceHelper.register(interceptors.stream()
.filter(s -> s.getClazz() == HttpInterceptorInterface.class)
.collect(Collectors.toList()));
HttpInstance.get();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy