当前位置:网站首页>Hello world of vertx
Hello world of vertx
2022-07-03 07:25:00 【Sleeping Empire】
1. maven Project dependence
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-web</artifactId>
</dependency>
2. Project part code
public class MainVerticle extends AbstractVerticle {
@Override
public void start(Promise<Void> startPromise) throws Exception {
vertx.createHttpServer().requestHandler(req ->
req.response()
.putHeader("content-type", "text/plain")
.end("Hello from Vert.x!")
).listen(8888, http -> {
if (http.succeeded()) {
startPromise.complete();
System.out.println("HTTP server started on port 8888");
} else {
startPromise.fail(http.cause());
}
});
}
}
Project start item
public class HelloWorldApplication {
public static void main(String[] args) {
Vertx vertx = Vertx.vertx();
vertx.deployVerticle(MainVerticle.class.getName());
}
}
3. Project test
After the project starts , Enter the address in the browser :http://127.0.0.1:8888; You can see the page information :Hello from Vert.x!
4. Full address of the project
边栏推荐
- 《指環王:力量之戒》新劇照 力量之戒鑄造者亮相
- MySQL syntax (basic)
- Use of file class
- 1. E-commerce tool cefsharp autojs MySQL Alibaba cloud react C RPA automated script, open source log
- Win 2008 R2 crashed at the final installation stage
- Leetcode 213: 打家劫舍 II
- Common APIs
- Deep learning parameter initialization (I) Xavier initialization with code
- twenty million two hundred and twenty thousand three hundred and nineteen
- The embodiment of generics in inheritance and wildcards
猜你喜欢
How to specify the execution order for multiple global exception handling classes
The embodiment of generics in inheritance and wildcards
“百度杯”CTF比赛 2017 二月场,Web:爆破-1
Hash table, generic
SecureCRT password to cancel session recording
JS monitors empty objects and empty references
Leetcode 213: 打家劫舍 II
Specified interval inversion in the linked list
在 4EVERLAND 上存储 WordPress 媒体内容,完成去中心化存储
Use of other streams
随机推荐
[Fiddler problem] solve the problem about Fiddler's packet capturing. After the mobile network is configured with an agent, it cannot access the Internet
Wireshark software usage
7.2 brush two questions
Common analysis with criteria method
Raspberry pie update tool chain
Interfaces and related concepts
Some experiences of Arduino soft serial port communication
Distributed lock
论文学习——鄱阳湖星子站水位时间序列相似度研究
Basic components and intermediate components
最全SQL与NoSQL优缺点对比
Advanced API (serialization & deserialization)
IP home online query platform
[solved] unknown error 1146
Advanced API (batch image Download & socket dialog)
Jeecg request URL signature
树莓派更新工具链
docker建立mysql:5.7版本指定路径挂载不上。
File operation serialization recursive copy
LeetCode