【问题标题】:Spring boot webflux deployment春季启动 webflux 部署
【发布时间】:2018-07-13 16:15:01
【问题描述】:

我有一个与 webflux 反应的 Spring Boot 项目。谁能告诉我如何在 Netty 上部署它?

谢谢

【问题讨论】:

    标签: spring-boot netty


    【解决方案1】:

    Spring boot 启动器 webflux 具有嵌入式 Netty,因此在您的项目中包含此依赖项并使用 main 方法声明一个类将在 Netty 中启动您的响应式 Web 应用程序。

    例如,如果您使用 Maven 添加这些依赖项:

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.5.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    

    然后在你的类中包含 main 方法:

    @SpringBootApplication
    public class DemoApplication {
    
        public static void main(String[] args) {
            SpringApplication.run(DemoApplication.class, args);
        }
    }
    

    或者,如果您想重新开始,一切都已经配置好并准备好编码:https://start.spring.io

    【讨论】:

      猜你喜欢
      • 2018-05-20
      • 2021-06-08
      • 1970-01-01
      • 2015-01-08
      • 2021-08-31
      • 2017-09-11
      • 2015-04-18
      • 2017-06-24
      • 2015-08-22
      相关资源
      最近更新 更多