我有一个与webflux反应的spring boot项目。有人可以告诉我如何在Netty上部署它吗?
谢谢
答案 0 :(得分:0)
Spring Boot Starter 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>
然后在包含主方法的类中:
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
或者如果您想重新开始配置所有内容并准备编写代码:https://start.spring.io。