【发布时间】:2018-07-13 16:15:01
【问题描述】:
我有一个与 webflux 反应的 Spring Boot 项目。谁能告诉我如何在 Netty 上部署它?
谢谢
【问题讨论】:
标签: spring-boot netty
我有一个与 webflux 反应的 Spring Boot 项目。谁能告诉我如何在 Netty 上部署它?
谢谢
【问题讨论】:
标签: spring-boot netty
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。
【讨论】: