当前位置:网站首页>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
边栏推荐
- 【已解决】Unknown error 1146
- [set theory] order relation (partial order relation | partial order set | example of partial order set)
- JUC forkjoinpool branch merge framework - work theft
- VMware virtual machine installation
- Store WordPress media content on 4everland to complete decentralized storage
- Realize the reuse of components with different routing parameters and monitor the changes of routing parameters
- CentOS switches and installs mysql5.7 and mysql8.0
- TCP cumulative acknowledgement and window value update
- URL programming
- sharepoint 2007 versions
猜你喜欢
随机推荐
Advanced API (multithreading 02)
SecureCRT password to cancel session recording
LeetCode
New stills of Lord of the rings: the ring of strength: the caster of the ring of strength appears
[set theory] equivalence classes (concept of equivalence classes | examples of equivalence classes | properties of equivalence classes | quotient sets | examples of quotient sets)*
【无标题】
[HCAI] learning summary OSI model
gstreamer ffmpeg avdec解码数据流向分析
7.2刷题两个
2021-07-18
[solved] unknown error 1146
Circuit, packet and message exchange
PgSQL converts string to double type (to_number())
VMWare网络模式-桥接,Host-Only,NAT网络
CentOS php7.3 installing redis extensions
[solved] sqlexception: invalid value for getint() - 'Tian Peng‘
2. E-commerce tool cefsharp autojs MySQL Alibaba cloud react C RPA automated script, open source log
When MySQL inserts Chinese into the database, there is a diamond question mark garbled code
Summary of Arduino serial functions related to print read
萬卷書 - 價值投資者指南 [The Education of a Value Investor]









