@ApplicationPath注释IS不拿到#3140
我正在尝试将Vert.x应用程序与Resteasy一起整理。当应用程序加载并启动服务器时。我期望/v1/health
可以正常工作,但它只是抛出404
main.java
public class Main extends AbstractVerticle {
private static VertxResteasyDeployment deployment;
public static void main(String[] args) {
Vertx vertx = Vertx.vertx();
deployment = new VertxResteasyDeployment();
deployment.setApplicationClass("starter.rx.endpoint.V1");
deployment.start();
vertx.deployVerticle("starter.rx.Main");
}
@Override
public Completable rxStart() {
VertxRequestHandler handler = new VertxRequestHandler(vertx.getDelegate(), deployment);
return vertx.createHttpServer()
.requestHandler(x -> handler.handle(x.getDelegate()))
.rxListen(80)
.ignoreElement();
}
}
v1.java
@ApplicationPath("v1")
public class V1 extends Application {
private final Set<Object> singletons = new HashSet<>();
public V1() {
singletons.add(new Management());
}
@Override
public Set<Object> getSingletons() {
return singletons;
}
}
Management.java
@Path("")
public class Management {
@GET
@Path("health")
public CompletionStage<String> health() {
return Flowable.just("healthy").singleStage("");
}
}
logs
22:48:47.658 [main] INFO o.jboss.resteasy.resteasy_jaxrs.i18n -
RESTEASY002225: Deploying jakarta.ws.rs.core.Application: class starter.rx.endpoint.V1
22:48:47.662 [main] INFO o.jboss.resteasy.resteasy_jaxrs.i18n -
RESTEASY002220: Adding singleton resource starter.rx.endpoint.Management from Application class starter.rx.endpoint.V1
输出
$ curl http://localhost:80/health
healthy
$ curl -i http://localhost:80/v1/health
HTTP/1.1 404 Not Found
transfer-encoding: chunked
这些是我正在使用的lib
"io.vertx" % "vertx-core" % "4.3.1",
"org.jboss.resteasy" % "resteasy-vertx" % "6.0.1.Final",
"io.vertx" % "vertx-rx-java3" % "4.3.1",
I'm trying to put together a vert.x application with resteasy. While the application gets loaded and the server starts up. I expected /v1/health
to work but it just throws a 404
Main.java
public class Main extends AbstractVerticle {
private static VertxResteasyDeployment deployment;
public static void main(String[] args) {
Vertx vertx = Vertx.vertx();
deployment = new VertxResteasyDeployment();
deployment.setApplicationClass("starter.rx.endpoint.V1");
deployment.start();
vertx.deployVerticle("starter.rx.Main");
}
@Override
public Completable rxStart() {
VertxRequestHandler handler = new VertxRequestHandler(vertx.getDelegate(), deployment);
return vertx.createHttpServer()
.requestHandler(x -> handler.handle(x.getDelegate()))
.rxListen(80)
.ignoreElement();
}
}
V1.java
@ApplicationPath("v1")
public class V1 extends Application {
private final Set<Object> singletons = new HashSet<>();
public V1() {
singletons.add(new Management());
}
@Override
public Set<Object> getSingletons() {
return singletons;
}
}
Management.java
@Path("")
public class Management {
@GET
@Path("health")
public CompletionStage<String> health() {
return Flowable.just("healthy").singleStage("");
}
}
Logs
22:48:47.658 [main] INFO o.jboss.resteasy.resteasy_jaxrs.i18n -
RESTEASY002225: Deploying jakarta.ws.rs.core.Application: class starter.rx.endpoint.V1
22:48:47.662 [main] INFO o.jboss.resteasy.resteasy_jaxrs.i18n -
RESTEASY002220: Adding singleton resource starter.rx.endpoint.Management from Application class starter.rx.endpoint.V1
Output
$ curl http://localhost:80/health
healthy
$ curl -i http://localhost:80/v1/health
HTTP/1.1 404 Not Found
transfer-encoding: chunked
These are the libs that I'm using
"io.vertx" % "vertx-core" % "4.3.1",
"org.jboss.resteasy" % "resteasy-vertx" % "6.0.1.Final",
"io.vertx" % "vertx-rx-java3" % "4.3.1",
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论