[英]How can I set the base path for my RESTEasy resources in Quarkus?
I would like to set the base path under which all my RESTEasy resources would fall, without having to include a class that extends javax.ws.rs.core.Application
.我想设置我的所有 RESTEasy 资源将落入的基本路径,而不必包含扩展javax.ws.rs.core.Application
的类。
Basically I would like to get rid of:基本上我想摆脱:
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/api")
public class MyApplication extends Application {
}
How can I achieve that?我怎样才能做到这一点?
Quarkus allows the base path to be configured in application.properties
(see here ). Quarkus 允许在application.properties
中配置基本路径(参见此处)。
So simply replace the class above with the following in application.properties
:因此,只需将上面的类替换为application.properties
中的以下内容:
quarkus.resteasy.path=/api
UPDATE更新
When using RESTEasy Reactive, as pointed out by https://stackoverflow.com/a/72426133/2504224 , one needs to use:正如https://stackoverflow.com/a/72426133/2504224所指出的,使用 RESTEasy Reactive 时,需要使用:
quarkus.resteasy-reactive.path=/api/
The accepted answer works for quarkus resteasy classic.接受的答案适用于 quarkus resteasy classic。
If you are using quarkus-resteasy-reactive
you will need to set:如果您使用的是quarkus-resteasy-reactive
,则需要设置:
quarkus.resteasy-reactive.path=/api/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.