com.litongjava.tio.boot.spring.EmbeddedTioBoot Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tio-boot Show documentation
Show all versions of tio-boot Show documentation
Java High Performance Web Development Framework
package com.litongjava.tio.boot.spring;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.web.reactive.server.ReactiveWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.litongjava.tio.boot.server.TioBootServer;
@Configuration()
@ConditionalOnMissingBean(ReactiveWebServerFactory.class)
@ConditionalOnClass({ TioBootServer.class })
public class EmbeddedTioBoot {
@Bean
public TioBootReactiveWebServerFactory tioBootReactiveWebServerFactory(
ObjectProvider routes, ObjectProvider serverCustomizers) {
TioBootReactiveWebServerFactory serverFactory = new TioBootReactiveWebServerFactory();
//serverFactory.setResourceFactory(resourceFactory);
routes.orderedStream().forEach(serverFactory::addRouteProviders);
List collect = serverCustomizers.orderedStream().collect(Collectors.toList());
serverFactory.getServerCustomizers().addAll(collect);
return serverFactory;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy